Use atop to monitor system and process activity in real time or replay binary log snapshots for historical diagnosis.
Install atop
Install atop:
Alibaba Cloud Linux 4/3/2, CentOS 7/8, or Fedora
# Update packages. sudo yum update -y # Install atop. sudo yum install atop -yUbuntu or Debian
# Update packages. sudo apt update -y # Install atop. sudo apt install atop -yCentOS Stream 9 or Rocky Linux 9
# Update packages. sudo dnf update -y # Install the EPEL repository. sudo dnf install epel-release -y # Install atop. sudo dnf install atop -yopenSUSE
# Update packages. sudo zypper update -y # Install atop. sudo zypper install atop atop-daemon -yStart the atop service:
sudo systemctl start atopVerify that the atop service started.
Run
sudo systemctl status atop. Theactive (running)status indicates success.
View real-time metrics
Run
atop [sampling_interval_in_seconds] [number_of_samples]to enter interactive mode. The output has two sections: system resource overview and process details.# View with default settings (refreshes every 10 seconds). atop # View system metrics every 5 seconds. atop 5 # Collect system metrics 30 times at 10-second intervals. atop 10 30 # Collect metrics 10 times at 30-second intervals and write the results to a file. atop 30 10 > /tmp/atop.memSystem resource overview: Summarizes CPU, memory, swap, disk I/O, and network usage.

Process-level details: Shows resource consumption per process.

Use single-letter keys to switch views or sort processes in interactive mode.
Key
Function
Purpose
c
Display the full command line
View the startup parameters of a process.
g
Generic view (default)
Summary of CPU, memory growth, and disk I/O.
m/M
Memory view/Sort by memory
Analyze memory usage, page faults, and memory leaks.
d/D
Disk view/Sort by disk
Identify processes with high disk read/write activity.
n/N
Network view/Sort by network (requires you to install and load the netatop kernel module)
Identify processes with high network traffic.
a
Aggregation view
Aggregate resource consumption of all threads or processes per program.
C
Sort by CPU
Identify the most CPU-intensive processes.
h
Show help
List all keyboard shortcuts.
q
Quit
Exit interactive mode.
View historical metrics
The atop service periodically writes binary log files to the /var/log/atop/ directory, named in atop_YYYYMMDD format.
atoplogs are binary files. Opening them with a text editor likecat,less, orvimdisplays unreadable characters.
Read historical logs
Read a historical log file:
Run
atop -r <log_file>to load a log file.# View today's log. atop automatically finds the log file for the current day. atop -r # View the log for a specific date. atop -r /var/log/atop/atop_YYYYMMDDNavigate to a specific time in the log:
When you load a log file, the first snapshot is displayed.
Press
tto jump to the next snapshot.Press
T(uppercase) to jump to the previous snapshot.Press
band enter a time inHH:MMformat to jump to that time.
Configure logging behavior
Adjust the logging frequency, retention period, and storage path by modifying the atop configuration file.
Open the configuration file with
vimor another editor:For RHEL and its derivatives (Alibaba Cloud Linux, CentOS, Fedora, and Rocky Linux):
sudo vim /etc/sysconfig/atopFor Debian and its derivatives (Ubuntu and Debian) and openSUSE:
sudo vim /etc/default/atop
The default configuration contains the following parameters:
LOGOPTS="" LOGINTERVAL=600 LOGGENERATIONS=28 LOGPATH=/var/log/atopLOGOPTS: Additional logging options. Setting-Lcreates a symbolic link at/var/log/atop/atop_currentpointing to the latest log file for quick access during log rotation.LOGINTERVAL: Sampling interval in seconds. Default:600(10 minutes), meaningatoprecords a snapshot every 10 minutes.LOGGENERATIONS: Log retention in days. Default:28.atopdeletes older logs automatically.LOGPATH: Log storage path. Default:/var/log/atop.Ensure the new directory exists and atop has write permissions.
Restart the
atopservice to apply changes:sudo systemctl restart atop
Generate metric reports
atopsar extracts data from atop binary log files to generate system performance reports.
Examples
Generate a CPU utilization report over a 1-minute period (12 samples at 5-second intervals):
atopsar -c 5 12Generate a memory report for a specific time range today:
# View the memory metric report for today from 18:00 to 18:01. atopsar -m -b 18:00 -e 18:01Generate a memory report for a specific time range on a specific date:
# View the memory metric report for August 15, 2025, from 18:00 to 18:01. atopsar -m -r /var/log/atop/atop_20250815 -b 18:00 -e 18:01
atopsar command syntax
atopsar [options] [interval] [count][options]: Report type flags, such as
-c(CPU),-m(memory), and-d(disk).[interval]: Report output interval in seconds.
[count]: Number of report iterations.
Metric reference
System resource overview
Metric Category | Metric | Description | Unit |
ATOP | Hostname, Date | Hostname, sampling date, and time. | - |
Sampling interval | Time interval between two samples. | Seconds | |
PRC (Process totals) |
| Total CPU time consumed by all processes in kernel mode. | Seconds |
| Total CPU time consumed by all processes in user mode. | Seconds | |
| Total number of processes. | Unit | |
| Average number of running threads. | Unit | |
| Number of threads in interruptible sleep. | Item | |
| Number of threads in uninterruptible sleep. | Unit | |
| Number of zombie processes. | Unit | |
| New processes or threads created via clone during the interval. | Count/second | |
| Processes that exited during the interval. | Count/second | |
CPU/cpu (Total/Per core) |
| CPU time spent in kernel mode. | % |
| CPU time spent in user mode. | % | |
| CPU time spent handling hardware interrupts (irq) and software interrupts (softirq). | % | |
| CPU completely idle. | % | |
| CPU idle while waiting for disk I/O. | % | |
| Time a virtual CPU waited for a physical CPU (stolen by the host or other VMs). | % | |
| CPU time spent running a virtual machine. | % | |
| Average CPU frequency as a percentage of maximum. | % | |
CPL (CPU load) |
| System load average over the last 1, 5, and 15 minutes. | - |
| Context switches during the interval. | Count/second | |
| Total interrupts during the interval. | Count/second | |
MEM (Physical memory) |
| Total physical memory. | GiB/MiB |
| Unused free memory. | GiB/MiB | |
| Memory used as page cache for file data. | GiB/MiB | |
| Dirty pages modified but not yet written to disk. | MiB | |
| Memory used as buffer cache for block device metadata. | MiB | |
| Memory used by the kernel slab allocator. | MiB | |
| Shared memory size, including tmpfs. | MiB | |
| (32-bit systems only) Balanced memory for virtual memory areas. | MiB | |
SWP (Swap partition) |
| Total swap space. | GiB/MiB |
| Free swap space. | GiB/MiB | |
| Memory swapped out but still cached. | MiB | |
| Total virtual memory committed by applications. | GiB/MiB | |
| Maximum virtual memory that can be committed. | GiB/MiB | |
PAG (Paging activity) |
| Pages scanned by the kernel to reclaim memory. | Pages/second |
| Pages successfully reclaimed after scanning. | Pages/second | |
| Stalls caused by insufficient memory during page reclamation. | Count/second | |
| Pages swapped in from swap to physical memory. | Pages/second | |
| Pages swapped out from physical memory to swap. | Pages/second | |
DSK (Disk) LVM (Logical Volume) |
| Disk busy percentage. 100% indicates saturation. | % |
| Read/write requests completed during the interval. | Count/second | |
| Average data size per read/write request. | KB | |
| Average time per read/write request, including queuing and service time. | Milliseconds | |
| Average I/O service time, excluding queuing. | Milliseconds | |
NET (Network) |
| TCP and UDP layer packet statistics. | Packets/second |
| IP layer packet statistics: received, sent, and forwarded. | Packets/second | |
| Activity for each network interface. | - | |
| Packets received/sent by the interface. | Packets/second | |
| Receive/send data speed. | Mbps | |
| Receive/send errors on the interface. | Count/second | |
| Packets dropped during receive/send on the interface. | Count/second |
Process-level details
View | Metric | Description | Unit |
Generic view (default) |
| Unique process identifier. | - |
| R-running, S-interruptible sleep, D-uninterruptible sleep, Z-zombie, E-exited. | - | |
| CPU utilization percentage. | % | |
| Memory usage percentage. | % | |
| Number of threads. | Unit | |
| Major page faults — reads from disk into memory. Indicates disk I/O pressure. | Count/second | |
| Executable name. Press c to show the full command line. | - | |
Memory view |
| Total virtual address space requested by the process. | KiB/MiB/GiB |
| Physical memory currently occupied by the process. | KiB/MiB/GiB | |
| Shared memory size. | KiB/MiB/GiB | |
| Resident memory growth. Positive = increasing, negative = decreasing. | KiB | |
| Virtual memory growth. | KiB | |
Disk view |
| Percentage of total disk busy time caused by this process. | % |
| Disk data read/written. | KiB/MB | |
| Data written to page cache but deleted before being synced to disk. | KiB/MB | |
Network view |
| Percentage of total network traffic generated by this process. | % |
| TCP data sent/received. | KiB/MB | |
| UDP data sent/received. | KiB/MB |
Apply in production
Disk space planning:
atoplog size depends on collection frequency, process count, and retention period. Check a single log file size withls -lh /var/log/atop/and multiply byLOGGENERATIONSto estimate total usage.Monitoring interval: For granular analysis, set
LOGINTERVALto 30 seconds. Shorter intervals increase disk I/O and CPU overhead ofatop. Adjust based on your workload.
FAQ
Why do I get the error
stat raw file: No such file or directorywhen runningatop -r?This error means
atopcannot find the log file for the specified date. Possible reasons:The
atopservice was not running on that date.The log was deleted by log rotation (
LOGGENERATIONSexceeded).The queried date is in the future.
Check
/var/log/atopfor available log files.
How can I reduce
atop's disk space usage?Modify the configuration file and restart the
atopservice:Reduce the log retention period: Lower the value of
LOGGENERATIONSin the configuration file, for example, from28to14.Decrease the collection frequency: Increase the value of
LOGINTERVALin the configuration file, for example, from600to1200.
Why can't I see per-process network traffic when I press the
nkey in atop's interactive mode?atopdoes not track per-process network traffic by default. Install and load thenetatopkernel module to enable this.Install the kernel development package and compilation tools:
sudo yum install -y kernel-devel dkms elfutils-libelf-develDownload the netatop source code:
cd /usr/src/ && sudo wget https://www.atoptool.nl/download/netatop-3.2.2.tar.gzExtract the source code and enter the directory:
sudo tar -zxvf netatop-3.2.2.tar.gz && cd netatop-3.2.2Build and install the module:
sudo make && sudo make installStart the
netatopservice:sudo systemctl start netatopVerify that
netatopis installed.Run
atopand pressn. ANETcolumn in the process list confirms success.
Why can't I view the historical processes that caused the fault after restarting my ECS instance?
By default, Linux does not record process-level historical resource usage, and restarting releases process information from memory. Without a monitoring tool installed beforehand, you cannot trace back to the fault scene before the restart, including issues such as system hangs, out-of-memory (OOM) errors, high
kswapd0load, and full I/O saturation.To be able to locate the root cause through historical logs when the next fault occurs, complete the following configuration in advance:
Install atop as described in this topic and enable auto-start on boot (
sudo systemctl enable atop) to ensure that atop continuously records process snapshots after the instance restarts. After configuration, when the next fault occurs, load historical logs withatop -r /var/log/atop/atop_YYYYMMDDto locate the root cause.