Friday, May 14, 2010

Let's change a process's IO niceness with ionice!

YES, as we get used to use nice to set the niceness of a process's CPU consumption when running a long task, we can nice the IO usage of it.

To start a process what only gets IO when nobody else needs it, just start it like

ionice -c 3 something.sh

"-c 3" sets it's class to Idle. Check out ionice's man page for more details.

Wednesday, May 5, 2010

Delete nth line of a file

I need this mostly when some host's ssh key changes, and complains about it and have to delete that line from .ssh/known_hosts. So

sed -i 10d somefile.txt

will delete the 10th line of somefile.txt.