snice
Change the scheduling priority of processes selected by user, tty, pid, or command.
Description
snice is the obsolete predecessor of renice; both tools are kept
for compatibility, but new use cases should prefer renice. The CLI
follows procps-ng’s convention where the priority adjustment is given
as a leading +N or -N argument (e.g. snice +7 -u alice).
The default priority is +4 (a small step toward “nicer” / lower
priority).
Inputs
setpriority(2)vialibc::setpriority(withPRIO_PROCESS)./proc/[pid]/{stat,status,cmdline}via the sharedprocmatchmodule for selection.
Synopsis
snice [new priority] [options] <expression>
expression is a list of bare PIDs (interpreted in conjunction with
-p). Selectors with explicit flags can be mixed with bare PIDs.
Arguments
| Flag | Description |
|---|---|
+N / -N (leading) | New nice value. Range typically -20 (highest priority) to +20 (lowest). Default: +4 |
--priority N | Same as the leading-flag form, but in long-flag style |
-n, --no-action | Don’t change priority; just print matching PIDs |
-v, --verbose | Print the PID, comm, and applied priority for each process |
-t, --tty TTY | Match processes whose controlling tty is TTY (repeatable) |
-u, --user USER | Match processes whose effective user is USER (repeatable) |
-p, --pid PID | Match processes by PID (repeatable) |
-c, --command CMD | Match processes whose comm is exactly CMD (repeatable) |
--help / -V, --version | Help / version |
The priority can appear anywhere on the command line; it is rewritten
internally to --priority N before clap parses argv (see
preprocess_argv). Bare positional integers are added to the PID list.
Behavior
Calls setpriority(PRIO_PROCESS, pid, N) for each matched process.
Negative priority values require the appropriate capability
(typically CAP_SYS_NICE or root); a process without that privilege
will see EPERM for any negative N.
Notes
-i(interactive),-f(fast),-w(warnings) and--ns/--nslistare listed in the upstream man page but not implemented here.
Exit codes
| Code | Meaning |
|---|---|
| 0 | At least one process matched and had its priority adjusted |
| 1 | No processes matched, or all setpriority calls failed |
| 2 | Usage error (no expression given, invalid argument) |