Tuesday, November 29, 2011

Just kill the process

/bin/kill -9 `/bin/cat /var/run/snmpd.pid`

To kill just the PID reported by the process as the active PID (with a shotgun, -9) and nothing else, use this shortcut.

Thursday, November 3, 2011

sed add line at end of file

If you want to add a a line of text to the end of a file, and want to do the edit in place, use this syntax:

sed -i '$ a\This is some sample text.'  /foo/bar