Atop Command Tutorial With Examples To Monitor Linux System Metrics


Atop is a monitoring tool which is mainly developed for command-line usage. It is capable of showing detailed information about the process, memory, disk network information, and metrics. Atop commands provides more details than popular top command.

atop Command Syntax

We will use following syntax for atop command.

atop OPTION

atop Command Help

Help information like flags, options can be listed with -h option.

$ atop -h
atop help
atop help

Start atop

Atop can be started just issuing atop command. But to get more detailed information and metrics about different subsystem usages providing root privileges are a better way.

$ sudo atop
Atop
Atop

As we can see from the screenshot the information provided is more than we may want the terminal screen fills up with monitoring information. We will look at how to show specific information about CPU, process, network, disk memory, etc.

Display CPU Usage

We can display CPU related information with c shortcut after atop started. This will list processes according to their CPU usage with their PID’s and full command line with parameters and options.

$ atop -c
Display CPU Usage
Display CPU Usage

Display Memory Usage

We can show memory usage with m shortcut. This will list information like PIC, minimum and maximum fault numbers, vstext, vsize,rsize,vgrow, rgrow, running user ID, effective user ID , memory usage, and command.

Display Memory Usage
Display Memory Usage

Display Disk Utilization

Another usage type of disk utilization. We will use –d option for this.

$ atop -d
Display Disk Utilization
Display Disk Utilization

We can see that disk utilization of the each process is show separately. Each process disk metrics like

  • RRDSK shows read disk
  • WRDSK shows write disk
  • WCANCL
  • DSK shows general disk usage
  • CMD shows related command
LEARN MORE  What Is DisplayPort?

Display Process Information In Cumulative Manner

Process information can be listed with –p option. This will also show other metrics about the disk, network, and memory.

$ atop -p
Display Process Information
Display Process Information
  • SYSCPU show system side CPU usage
  • USRCPU shows user side CPU usage
  • VSIZE shows virtual memory size
  • RSIZE shows real memory size
  • RDDSK shows disk read
  • WRDSK shows disk write
  • RNET shows network receive
  • SNET shows network send
  • CPU shows shortcutCPU usage percentage
  • CMD shows related command

Display Process Information In Cumulative Manner According To User

Another useful feature of the atop is showing metrics from the user perspective. This shortcut will sum up all metrics according to the user. We will use –u option.

$ atop -u
Display Process Information In Cumulative Manner According To User
Display Process Information In Cumulative Manner According To User

Display Network Usage shortcut

Network usage can be displayed with  -n option. But there is a dependency for netatop to probe the network information.

$ atop -n

Show Generic Information

General information about system an process can be listed with -g option like below.

Show Generic Information
Show Generic Information

This will list information like

  • PID
  • EUID
  • USR CPU User level CPU usage
  • CPU CPU usage
  • RDDSK Read disk
  • WRDSK  Write to disk

Show All Process

Up to now only active process are shown. We can list all process without filtering them with -a option.

$ atop -a
Show All Process
Show All Process

Display Details / Verbose Mode

More details about current windows can be shown with verbose mode. The verbose mode can be call -v option or v shortcut after atop starts.

$ atop -v
Display Details / Verbose Mode
Display Details / Verbose Mode

As we can see from previous screenshot the following information is provided for each process.

  • PID Process ID
  • PPID Parent Process ID
  • RGID
  • EUID
  • STDATE
  • STTIME
  • ENDATE
  • ENTIME
  • ST
  • EXC
  • S
  • CPU
  • CMD

Show Threads

We can also show a thread-based list. In this view, the Thread ID and related information will be shown. There will be also the process name at the end of the line.

$ atop -y
Show Threads
Show Threads

Write To Log File

atop is a very analytical tool where we can save the monitored values into a file to read in the future. We will redirect into a binary format file with the -w option. We will name the log file as atop.raw

$ atop -w /root/atop.raw

Read From Log File

We can also read from a log file too. This will be beneficial If we need to investigate a past event for a specified time. We will use -r and the log file name which is atop.raw in this case.

$ atop -r /tmp/atop.raw

Set Global Configuration

If we generally need to use specific options we can specify them in a global configuration file which will effect for each atop run.  We will use /etc/atoprc .

LEARN MORE  How To Solve "DNS Server not responding"

Set User Based Configuration

We can also set user level configuration which will overload global configuration if defined. This configuration file is located ~/.atoprc

Leave a Comment