Using the top Command in the ChromeOS Linux Environment
The top command in Linux provides a real-time, dynamic overview of system resource usage, including CPU and memory consumption, running processes, and system load. It is an essential tool for monitoring system performance in the ChromeOS Linux (Crostini) environment.
Basic Usage
Running top
To start top, simply run:
bash
top
This displays a real-time list of system processes, sorted by CPU usage by default.
Exiting top
To exit top, press:
q
Understanding the Output
A typical top display consists of:
- System Uptime & Load Averages: Shows how long the system has been running and the load averages over 1, 5, and 15 minutes.
- Task Summary: Displays the number of total, running, sleeping, stopped, and zombie processes.
- CPU Usage: Shows CPU utilization by system, user, and idle time.
- Memory Usage: Displays the total, used, and free memory (RAM and swap).
- Process List: Displays active processes sorted by CPU usage.
Navigating top
While top is running, you can use the following keys to interact with it:
- h – Show help menu
- k – Kill a process by entering its PID
- r – Renice a process (change priority)
- M – Sort by memory usage
- P – Sort by CPU usage
- q – Quit
top
Filtering and Sorting
Displaying Only Processes for a Specific User
To view processes owned by a specific user, use:
bash
top -u username
Changing the Refresh Interval
To change the update interval (default: 3 seconds), use:
bash
top -d 1
Sorting by Memory Usage
To sort by memory usage instead of CPU, press:
M
Practical Use Cases
- Monitoring CPU-intensive processes:
bash top - Identifying memory-hungry applications:
bash top -o %MEM - Killing unresponsive processes:
bash top (press `k` and enter the PID)
Conclusion
The top command is an essential tool for monitoring system health and managing processes in the ChromeOS Linux environment. With real-time insights into CPU and memory usage, top helps users identify performance bottlenecks and optimize resource utilization.