Making the Shell Play “nice”
Being a big fan of the shell, I make it work hard for me. Often times the commands I’ll issue through the shell are greedy and eat CPU cycles like candy. Sometimes those commands might take several minutes to complete, and I want my CPU’s priority to be focused on other things (like letting me get back to blogging).To handle those special situations for me, I use the “nice” command. It’s really easy. You simply precede any command with the word “nice” and it works it’s magic.
For example, when I’m backing up my email and favorites, I can use the command like this:
nice tar -cf mybackup.tar outlookdata.dat myfavorites.dat
You can tailor nice’s effectiveness to suit your needs, using the -n argument. For example, maybe I want my backup to be priority so that I can get back to what I’d rather be doing. In that case, I’d use:
nice -n=-20 tar -cf mybackup.tar outlookdata.dat myfavorites.dat
Possible values range from -20 (least “favorable”) to 19 (most “favorable”).
