Linux Commands Examples

A great documentation place for Linux commands


run a program with modified scheduling priority


nice [OPTION] [COMMAND [ARG]...]

add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!


nice rsync -rvh --size-only -progress $@
nice rsync --dry-run -rivh $@

Does the Linux 'nice' command work on any shell script?

Nice applies to the process that is started when running the command and any child processes. So the answer to your question is yes, it does work on any commands/scripts, even if they are put into the background.


How do I elevate the priority of a process without giving that process superuser rights?

One possibility is this (which I just thought of after asking):

sudo nice -10 sudo -u user command

But it seems like there should be a more elegant method.


Remember the nice value in Linux

I don't really think you can. I have a shortcut / bash script that renice's itself and then launches the executable associated with it. I generally don't have too many processes that I have to renice (just my minecraft server), so I haven't found it to be too big of an issue.

renice 4 -p $$
mono McMyAdmin.exe

and then I just run the script instead of the executable I usually would.


Why I can decrease the process's priority by using nice() function with a typical user permission(except ROOT) in linux?

void main()
    int n=10;
    (void)setpriority(PRIO_PROCESS, 0, n);

After setting the process priority to required level, delay by 1 mins so that we can check altered priority in top/ps command. Check this link,


can I `dtach` or `renice` graphical programs like `evince`?

dtach does not influence OS resources in the sense that it reduces RAM or CPU cycles, dtach detaches a process from it's parent process. renice on the other hand increases / decreases the priority of the process for the schedular; the process will gain more cpu-cycles .

So: yes, you can use dtach to detach evince from your xterm (I doubt that you open evince via xterm anyway). This would only ensure that closing xterm won't close evince. Yes, you can renice a lower priority to evince and then the scheduler will call evince less often. Memory wise there won't be any change at all. To reduce work load you might minimize evince so it is not visible and thus nothing new will be rendered and no checks against overlapping due to other programms will take place.

But, and I mean that in all seriousness: Stop fiddling around with your system in such micromanagement style and just buy more RAM. As long as you don't open 1000s of evince to be read later (which is a usage pattern I would change in the first place) the OS will behave not really differently when you microtune the OS. If you don't want to read the .pdfs now: save them to disk. Problem solved.


Extra low priority processes in linux?

You could make use of cgroups for that one really low priority process. You can create a cgroup just for that one process (call it lowprio or w/e) and use the cpu.shares parameter to only allow it a certain share of CPU time. You can read more about this approach in, e.g., RHEL's Resource Management Guide.


Run COMMAND with an adjusted niceness, which affects process scheduling. With no COMMAND, print the current niceness. Niceness values range from -20 (most favorable to the process) to 19 (least favorable to the process).
, --adjustment=N

add integer N to the niceness (default 10)


display this help and exit


output version information and exit

NOTE: your shell may have its own version of nice, which usually supersedes the version described here. Please refer to your shell’s documentation for details about the options it supports.


Copyright © 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

reporting bugs

Report nice bugs to bug-coreutils[:at:]gnu[:dot:]org
GNU coreutils home page: <>
General help using GNU software: <>
Report nice translation bugs to <>

see also


The full documentation for nice is maintained as a Texinfo manual. If the info and nice programs are properly installed at your site, the command

info coreutils 'nice invocation'

should give you access to the complete manual.


Written by David MacKenzie.

How can this site be more helpful to YOU ?

give  feedback