Overview
atop is an interactive monitoring tool that provides a comprehensive view of the system's current state. It also offers the ability to record snapshots at specific times for later analysis, making it excellent for identifying bottlenecks in system resource utilization.
Key Features
- Real-time system resource usage monitoring (CPU, memory, disk, network)
- Detailed activity information per process and thread
- Historical performance data logging and analysis capabilities
- Switch between various views (memory, disk, network, etc.) through an interactive interface
- Clear identification of the causes of system load (CPU, memory, I/O, etc.)
Key Options
The atop command allows for fine-grained control over monitoring methods and output content through various options.
Monitoring and Logging
Control Output Content
Generated command:
Try combining the commands.
Description:
`atop` Executes the command.
Combine the above options to virtually execute commands with AI.
Usage Examples
Examples demonstrating various ways to use atop.
Basic Real-time Monitoring (5-second interval)
atop -i 5
Monitors the system's current state at 5-second intervals.
Log Activity Data to File
atop -a -i 10 600 > atop_log.raw &
Logs system activity in the background for 600 seconds (10 minutes) at 10-second intervals to the file 'atop_log.raw'.
Read Data from Logged File
atop -r atop_log.raw
Reads and replays data from the previously logged file 'atop_log.raw'.
View Detailed Memory Usage
atop -m
Monitors system status including detailed memory-related information.
View Detailed Disk I/O
atop -d
Monitors system status including detailed disk I/O-related information.
View Detailed Network Activity
atop -n
Monitors system status including detailed network interface-related information.
Installation
atop is not included by default in most Linux distributions and must be installed via a package manager.
Debian/Ubuntu
sudo apt update
sudo apt install atop
Installs atop using the APT package manager.
CentOS/RHEL/Fedora
sudo yum install atop # or sudo dnf install atop
Installs atop using the YUM or DNF package manager.
Tips & Notes
Useful tips and points to note when using atop. You can quickly switch between different information displays by pressing specific keys in interactive mode.
Key Interactive Keyboard Shortcuts
While atop is running, press the following keys to change the displayed information.
- g: Switch to the default (general) view
- m: Display memory-related information
- d: Display disk I/O-related information
- n: Display network-related information
- u: Sort processes by CPU usage
- p: Sort processes by memory usage
- t: Change sort order to chronological
- l: Sort processes by network usage
- c: Show/hide process command lines
- v: Display thread information per process
- s: Display scheduling information per process
Log File Management
By default, atop creates daily log files in the '/var/log/atop/' directory. These files can consume significant disk space over time, so periodic management (e.g., logrotate configuration) may be necessary.
Using atopsar
The atop package also includes a utility called 'atopsar'. This tool can be used to extract statistical data for specific periods from atop log files and generate reports, making it very useful for historical performance analysis.