nice
Run programs with modified scheduling priority
TLDR
Launch a program with altered priority
Define the priority with an explicit option
SYNOPSIS
nice [OPTION]... [COMMAND [ARG]...]
PARAMETERS
-n, --adjustment=N
Add integer N to the niceness value. If N is not specified, it defaults to 10. May be negative (if the user has sufficient privileges).
-a, --all
(deprecated) Affect all processes. Generally, this option is not supported and has no effect.
--help
Display a help message and exit.
--version
Output version information and exit.
DESCRIPTION
The nice command allows users to influence the scheduling priority of a process. Lowering the "niceness" value (represented by a negative number) increases the priority, while increasing the niceness value (positive number) decreases the priority.
By default, processes start with a niceness of 0. Only the superuser (root) can lower the niceness value (i.e., give a process higher priority). Regular users can only increase the niceness value (i.e., lower a process's priority).
The command takes a numeric argument that represents the amount to adjust the niceness value. If no adjustment value is specified, nice defaults to an increment of 10. This command is useful to ensure that less important background tasks don't negatively impact interactive performance. Using nice inappropriately can starve other processes of CPU time, so use it judiciously.
CAVEATS
Only root can decrease the niceness value (give a process higher priority). Regular users can only increase the niceness value, limiting its impact.
EXAMPLE USAGE
To start a CPU-intensive program with a lower priority (niceness increased by 10): nice ./myprogram
To start a program with a specific niceness value (e.g., 15):nice -n 15 ./myprogram
As root, to start a program with a higher priority (niceness decreased by 5):sudo nice -n -5 ./myprogram
HISTORY
The nice command has been a part of Unix-like operating systems for a long time, dating back to early Unix versions. Its primary purpose has always been to allow users and administrators to manage process priorities, especially in multi-user environments, ensuring fair resource allocation and preventing resource hogging.