Category: linux

  • Using less with syntax highlight

    You can use vim as your pager and obtain two benefits: syntax highlight and access to all the advanced commands (like search). You can do this under ubuntu by adding the following line to your ~/.bashrc: alias less=’/usr/share/vim/vimcurrent/macros/less.sh’ Note: You have to have vim installed (which doesn’t come by default, but it is as simple…

  • Quick’n’dirty Mediawiki file crawler

    URL=’http://10.0.0.1′ MIME=’image/jpeg’ bash -c ‘wget -q -O – “$URL/wiki/index.php?title=Special:MIMESearch&mime=$MIME&limit=500&offset=0” | grep -Po “/wiki/images[^”]+” | xargs -n1 -I {} wget “$URL{}”‘ What it does: it uses the “MIME search” functionality on the wiki to locate files of a certain mime type and then xargs+wget each of them. Limitations: A maximum of 500 files are downloaded Downloads…

  • Creating a non-MAC bound CentOS 6 machine

    I was building VMs to be deployed with Vagrant / Virtualbox for our QAs and discovered that on new instantiations of the machine the networking interface wasn’t coming up. The problem was that Virtualbox was assigning a random MAC address to the NIC (and rightly so, to avoid conflicts). I used the following steps to…

  • Booting the Linux Kernel from Grub2

    Recently a good friend of mine managed to uninstall all the kernels from his Ubuntu machine (what can I say – Monday morning and no coffee is a deadly combination). Luckily he had the install CD on hand so we did the following: Boot from the CD (we had Internet connection) Mount the Linux partition…

  • Recovering encrypted home directory under Ubuntu

    While the home-folder encryption in Ubuntu is far from a perfect solution (there is considerable data leakage from the swap file and the temp directory – for example once I’ve observed the flash videos from Chromium porn private browsing mode being present in the /tmp directory), it is a partial solution nevertheless and very easy…

  • Setting the maximum number of opened files under Ubuntu (for JProfiler)

    As I found out “on my own skin”, setting fs.file-max in /etc/sysctl.conf is a BAD idea. It can render your system useless in one step. Please don’t do it! If you did it, use the recovery mode to roll back the change. Also, currently I would only recommend doubling the limit (ie going from 1024…

  • Problems (and a semi-solution) for tcpdump with DAG cards

    Documenting here for posterity, since I didn’t find much information about it on the ‘net: Disclaimer: I’m not a network head, just an amateur who dabbles with it when he needs to fix a problem. Given one Ninjabox (the nickname for packet capture boxes from Endace) with a DAG card (some kind of custom packet…

  • An useful Ubuntu (online) resource

    If you use Ubuntu, the full circle magazine is a great resource, go check it out. For example from the latest issue I’ve learned that I should install vim-nox on my servers if I want to upgrade my 1980’s experience to 1990’s :-). I there is one (small) issue, it is the fact that the…

  • How to save/restore iptables rules on Ubuntu?

    This might be an obvious thing to old Linux-heads out there, but it sure caught me off-guard, so there might be some use in spelling it out: iptables-save and iptables-restore do not actually save/load the iptables rules to/from an external file. You are responsible for redirecting the output of iptables-save to a file and modifying…

  • Don’t listen alone!

    Do you like Linux? Do you listen to podcasts? If you’ve answered yes to both of those questions, you should know what LUG Radio is (if not, do a quick checking – I promise you that it will be worth it!). The bad news? They stopped it in 2008. The good news? A documentary titled…