Run a command with low/high priority in Linux
In Category Command Line
The “nice” command can be used to alter the priority of a command executed. This commands takes an optional argument with -n option that specific niceness of process going to be created. This option expects an integer ranging from -20 (highest priority) to 19 (lowest priority). This is an optional parameter and its default value is 10. The following example shows how a new software installation using “yum” is set to low priority.
[neo@techpulp ~]# nice yum install Basket
In general a process created in Linux has nice value of 0. So you can use “nice” command to specify lower value to specify higher priority than default nice value of a standard Linux process. But as a normal user you can’t increase priority of a process so you will have to be super user to do that.
[root@techpulp ~]# nice -n -10 yum install Basket
Similarly any value greater than zero can be given to run a command at lower priority than a standard Linux process. Any user can reduce the priority of a command/process.
[neo@techpulp ~]# nice -n 5 yum install Basket