info > nice

📘 NAME

nice — run a command with modified niceness

🚀 Quick Reference

Use Case Command Description
Print current niceness nice Displays the current niceness value
Run command with increased niceness nice <command> Increments niceness by 10 (default)
Run command with specific niceness nice -n <adjustment> <command> Adds ADJUSTMENT to current niceness
Run command with lower niceness (privileged) sudo nice -n -1 <command> Requires root privileges
Check niceness of a command nice nice Shows current niceness + 10
Relative niceness adjustment nice -n 3 <command> Adds 3 to current niceness (e.g., 10 → 13)

📖 Synopsis

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

📝 Description

nice prints a process's "niceness", or runs a command with modified niceness. "niceness" affects how favorably the process is scheduled in the system.

If no arguments are given, nice prints the current niceness. Otherwise, nice runs the given COMMAND with its niceness adjusted. By default, its niceness is incremented by 10.

Niceness values range at least from -20 (process has high priority and gets more resources, thus slowing down other processes) through 19 (process has lower priority and runs slowly itself, but has less impact on the speed of other running processes). Some systems may have a wider range of niceness values; conversely, other systems may enforce more restrictive limits. An attempt to set the niceness outside the supported range is treated as an attempt to use the minimum or maximum supported value.

A niceness should not be confused with a scheduling priority, which lets applications determine the order in which threads are scheduled to run. Unlike a priority, a niceness is merely advice to the scheduler, which the scheduler is free to ignore. Also, as a point of terminology, POSIX defines the behavior of nice in terms of a "nice value", which is the non-negative difference between a niceness and the minimum niceness. Though nice conforms to POSIX, its documentation and diagnostics use the term "niceness" for compatibility with historical practice.

COMMAND must not be a special built-in utility.

Due to shell aliases and built-in nice functions, using an unadorned nice interactively or in a script may get you different functionality than that described here. Invoke it via env (i.e., env nice ...) to avoid interference from the shell.

Note to change the "niceness" of an existing process, one needs to use the renice command.

nice is installed only on systems that have the POSIX setpriority function, so portable scripts should not rely on its existence on non-POSIX platforms.

⚙️ Options

🚪 Exit Codes

💡 Examples

Run a non-interactive program with reduced niceness:

$ nice factor 4611686018427387903

Demonstrate how nice works — default increments by 10:

$ nice
0
$ nice nice
10
$ nice -n 10 nice
10

ADJUSTMENT is relative to current niceness. First nice runs second with niceness 10, then second adds 3:

$ nice nice -n 3 nice
13

Setting niceness beyond supported range uses maximum:

$ nice -n 10000000000 nice
19

Only a privileged user may run a process with lower niceness:

$ nice -n -1 nice
nice: cannot set niceness: Permission denied
0
$ sudo nice -n -1 nice
-1
nice
📘 NAME 🚀 Quick Reference 📖 Synopsis 📝 Description ⚙️ Options 🚪 Exit Codes 💡 Examples

Generated by phpman v4.9.26-1-g511901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-31 09:08 @216.73.217.152
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format

^_top_^