Forrest logo
tool overview
On this page you find all important commands for the CLI tool ionice. If the command you are looking for is missing please ask our AI.

ionice

Ionice is a command-line tool that allows users to prioritize disk I/O for a given process or command under Linux. It works by manipulating the ionice values associated with processes, which determines their I/O priority.

The tool provides three different I/O classes that can be assigned to processes: idle, best-effort, and real-time. The idle class provides the lowest priority to the process, allowing it to use disk resources only when no other process is requesting them. The best-effort class is the default and provides a balanced allocation of disk I/O resources to processes. The real-time class gives the highest priority to the process, allowing it to access disk I/O resources with higher preference.

Each class, except idle, has eight different priority levels ranging from 0 to 7, with 0 being the highest and 7 the lowest. The higher the priority level, the more access the process will have to the disk I/O resources.

Ionice is usually used with the 'ionice' command followed by the priority level and command to be executed. For example, 'ionice -c2 -n0' sets the process to the highest best-effort priority level.

Using ionice can be particularly useful when running demanding tasks in the background without affecting the responsiveness of the system, as it allows users to allocate disk I/O resources more efficiently. This is particularly important in scenarios where multiple processes are competing for disk access.

Ionice is part of the util-linux package and is available by default on most Linux distributions. It is a powerful tool that can optimize disk I/O operations and improve system performance by fine-tuning process priorities.

List of commands for ionice:

  • ionice:tldr:3fa12 ionice: Set I/O scheduling class of a running process.
    $ ionice -c ${scheduling_class} -p ${pid}
    try on your machine
    explain this command
  • ionice:tldr:afdf5 ionice: Run a command with custom I/O scheduling class and priority.
    $ ionice -c ${scheduling_class} -n ${priority} ${command}
    try on your machine
    explain this command
  • ionice:tldr:ba374 ionice: Print the I/O scheduling class and priority of a running process.
    $ ionice -p ${pid}
    try on your machine
    explain this command
tool overview