The nice command is used to adjust the priority of a process. The priority ranges from -20 to 19, where lower values represent higher priorities. Only the root user can set negative values. If a process doesn't have a specific priority set with nice, its priority is 0 by default.
To set the priority using nice, the syntax is nice -n# COMMAND_TO_RUN or nice -# COMMAND_TO_RUN (where "#" is a number in the range of -20 to 19). If you use nice without specifying a priority, the default value is 10 (lowering the priority).
Here's an operational example:$ nice seq 200000000 > /dev/null & ←Run the 'seq' command in the background with a nice priority [1] 9883 $ ps -o pid,ni,comm ←Use 'ps' to observe the processes PID NI COMMAND 9615 0 bash 9883 10 seq ← Priority = 10 (NI column indicates the priority value) 9890 0 ps |