renice
Overview
The renice
command alters the scheduling priority of running processes. It allows you to change the nice value of processes that are already running.
Syntax
renice [-n] priority [-g|-p|-u] identifier...
Common Options
Option | Description |
---|---|
-n |
Specify nice increment |
-g |
Interpret as process groups |
-p |
Interpret as process IDs |
-u |
Interpret as usernames |
--help |
Display help |
--version |
Show version |
Nice Values
- Range: -20 to 19
- Lower values = higher priority
- Higher values = lower priority
- Only root can set negative values
- Default: current nice value
Key Use Cases
- Adjust process priority
- Resource management
- Performance tuning
- System optimization
- Process control
Examples with Explanations
Example 1: Basic Usage
renice +5 -p 1234
Change priority of PID 1234
Example 2: User Processes
renice 10 -u username
Change priority of user’s processes
Example 3: Process Group
renice -5 -g 100
Change priority of process group
Understanding Output
Format:
1234: old priority 0, new priority 5
Error messages for: - Permission denied - Invalid priority - Process not found - User not found
Common Usage Patterns
Lower process priority:
renice +10 -p $(pgrep firefox)
Increase user priority:
sudo renice -5 -u apache
Multiple processes:
renice 5 -p 1234 5678
Performance Analysis
- Priority impact
- System load effect
- Resource allocation
- Process behavior
- Scheduling changes
Additional Resources
Best Practices
- Monitor system impact
- Document changes
- Consider dependencies
- Regular review
- Use appropriate values
Use Cases
- Performance tuning
- Resource allocation
- System maintenance
- Service optimization
- Troubleshooting