How to Run unrar with Reduced CPU Priority on Linux

Extracting large RAR archives using unrar can consume significant CPU resources, leading to system sluggishness or unresponsiveness during intensive decompression tasks. This guide explains how to use the standard Linux nice utility to lower the CPU scheduling priority of unrar, as well as how to manage I/O priority using ionice and adjust running processes with renice.

Using the nice Command

The standard way to run a command with reduced CPU priority on Linux is via the nice utility. Linux scheduling priority ranges from -20 (highest priority) to 19 (lowest priority). A standard process launches with a default nice level of 0.

To run unrar at the absolute lowest CPU priority, assign it a niceness value of 19:

nice -n 19 unrar x archive.rar

When run this way, unrar will yield CPU cycles to any other process requesting system resources, only consuming CPU time when the processor is otherwise idle.

Combining with ionice for Reduced Disk Priority

Because decompressing archives also involves heavy disk read and write operations, high I/O wait times can slow down a system even if CPU priority is reduced. To lower both CPU and disk priority simultaneously, combine nice with ionice set to the "Idle" class (-c 3):

ionice -c 3 nice -n 19 unrar x archive.rar

With this command:

  • ionice -c 3 ensures the process only accesses the disk when no other program has pending I/O requests.
  • nice -n 19 ensures the process only uses idle CPU cycles.

Lowering Priority of an Already Running unrar Process

If an unrar task is already running and consuming too much CPU, you can lower its priority dynamically without stopping the extraction using the renice command.

  1. Find the Process ID (PID) of the running unrar command:
pgrep unrar
  1. Change its nice level to 19 using the retrieved PID:
renice -n 19 -p <PID>

Replace <PID> with the actual process ID output by the first command.