Don't be nice -- be RENICE

Most Linux folks are familiar with the NICE command, which adjusts the priority with which a process runs. You can use NICE to put a program like printing or FTP downloading into the background so that your other processes aren't impacted, or promote a process to the foreground to make that process run more quickly. A related command, RENICE lets you continue to run a process in the background when you logoff your system.

Let's assume that you are running a program in the background and you have to head home from work. First you need to know the Process ID (PID) of your program:

ps –a | programname

which returns a set of values:

1234 pts/2 20:10 programname.

This indicates that the PID is 1234 and it is being run at tty2. The RENICE command:

renice -n PRI -p PID

would then have its PRI or priority set with the PID number. The range of RENICE (as is true of NICE itself) is 19 to -19. So to put this program into the background you would enter:

renice -n 19 -p 1234

This command lowers the priority from 0 to -19 and programname runs only when the system is idle, and doesn't impact on other users. With luck your process will be complete when you return, or failing that would have more efficiently used your system resources.

You can find a description of RENICE parameters

Requires Free Membership to View


Barrie Sosinsky is president of consulting company Sosinsky and Associates (Medfield MA). He has written extensively on a variety of computer topics. His company specializes in custom software (database and Web related), training and technical documentation.

This was first published in October 2003

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.