Debian Static IP
02 January 2013

I am working with a small debian linux server and was trying to set eth0 to a static IP address but it was getting reset after boot. I turns out, there's a daemon called ifplugd that automatically configures specified interfaces in which eth0 was specified.

To resolve this, remove all references to the interface from /etc/default/ifplugd

List open files
24 June 2011

To view and/or count the open files belonging to a process


ls -l /proc/[pid]/fd


ls -l /proc/[pid]/fd | wc -l
VMWare Trick
09 March 2011

I've been copying a lot of Ubuntu VMs around lately andam always annoyed to find that after copying, the new VM network setup is broken. After searching on and off for quite a while I discovered a solution. In /etc/udev/rules.d/ you will see a file named xx-persistent-net.rules This file keeps track of what network devices get what name -in most cases, eth0. If you delete this file on the newly created machine, it will reset your network devices and rebuild this file.

sed + find
17 December 2010

I needed to add a style to every theme for a site (100s). I decided to go simple and just append to the file instead of inserting at a certain point since I didn't know what state any of the themes were in.

This was my solution:

sed -i '$adiv#shortcuts.span-18 {color: #009;text-decoration: underline;}' `find /path/to/themes -name screen.css`