Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify the content of the nice and renice command entries #2429

Merged
merged 3 commits into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions docs/books/admin_guide/08-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,17 +314,31 @@ The command `nice` allows the execution of a command by specifying its priority.
nice priority command
```

Example:
Usage example:

```bash
nice -n+15 find / -name "file"
nice --adjustment=-5 find / -name "file"

nice -n -5 find / -name "file"

nice --5 find / -name "file"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-5 != --5

@jimcat8

Copy link
Contributor Author

@jimcat8 jimcat8 Oct 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice nice --3 nice
7

@wsoyinka

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wsoyinka Are you still waiting for a change on this?


nice -n 5 find / -name "file"

nice find / -name "file"
```

Unlike `root`, a standard user can only reduce the priority of a process. Only values between +0 and +19 will be accepted.
Unlike `root`, a standard user can only reduce the priority of a process and only values between 0 and 19 will be accepted.

As shown in the example above, the first three commands indicate setting the Nice value to "-5", while the second command is our recommended usage. The fourth command indicates setting the Nice value to "5". For the fifth command, not typing any options means that the Nice value is set to "10".

!!! Tip

This last limitation can be lifted per-user or per-group by modifying the `/etc/security/limits.conf` file.
"Nice" is the abbreviation for "niceness".

Directly typing the `nice` command will return the Nice value of the current shell.

You can lift the Nice value limit for each user or group by modifying the `/etc/security/limits.conf` file.

The `renice` command allows you to change the priority of a running process.

Expand All @@ -335,7 +349,7 @@ renice priority [-g GID] [-p PID] [-u UID]
Example:

```bash
renice +15 -p 1664
renice -n 15 -p 1664
```

| Option | Description |
Expand All @@ -351,9 +365,11 @@ The `renice` command acts on processes already running. It is therefore possible
The `pidof` command, coupled with the `xargs` command (see the Advanced Commands course), allows a new priority to be applied in a single command:

```
$ pidof sleep | xargs renice 20
$ pidof sleep | xargs renice -n 20
```

To adapt to different distributions, you should try to use command forms such as `nice -n 5` or `renice -n 6` as much as possible.

### `top` command

The `top` command displays the processes and their resource consumption.
Expand Down
Loading