nice
Overview
The nice
command runs a program with modified scheduling priority. It allows you to start a process with a different niceness (priority) value.
Syntax
nice [options] [command [arguments]]
Common Options
Option | Description |
---|---|
-n adjustment |
Priority value |
--adjustment |
Priority value |
-h |
Show help |
-v |
Verbose mode |
--version |
Show version |
Nice Values
Value | Priority |
---|---|
-20 | Highest |
-10 | High |
0 | Normal |
10 | Low |
19 | Lowest |
Key Use Cases
- Process priority
- Resource control
- Background tasks
- System optimization
- Performance tuning
Examples with Explanations
Example 1: Basic Usage
nice command
Run with default nice
Example 2: Set Priority
nice -n 10 command
Run with lower priority
Example 3: High Priority
nice -n -10 command
Run with higher priority
Common Usage Patterns
Background task:
nice -n 19 longprocess
CPU intensive:
nice -n -10 compute
Check nice:
nice -n 0 nice
Priority Management
- Default priority
- Adjustment range
- User limits
- System impact
- Process groups
Additional Resources
Best Practices
- Check limits
- Monitor impact
- Document usage
- Test settings
- Regular review
Security Considerations
- User permissions
- System resources
- Priority limits
- Process control
- Resource abuse
Troubleshooting
- Permission denied
- Priority limits
- System load
- Process behavior
- Resource conflicts
System Impact
- CPU scheduling
- Process priority
- System load
- User experience
- Resource sharing