7 Alternatives to the top Command

Author: JackTian
Source: Public Account "Jie Ge's IT Journey"
ID: Jake_Internet
Reprint please contact authorization (WeChat ID: Hc220088)
Original address: 7 tools that can replace the top command! (two)

Hello everyone, my name is Jack.

In the previous article, I introduced you to 11 tools that can replace the top command! ", today I will recommend 7 tools that can replace the top command. After reading the articles on these two alternatives, I believe it will open your eyes to the next small command of the Linux operating system.

1. atop

atop[^1] is an ASCII full-screen performance monitor for Linux operating system based on C language, which can record all processes (even if the process has been completed during the interval), system and process activity daily log Logging for long-term analysis, by color highlighting overloaded system resource usage, etc.

At the same time, it also periodically displays system-level activity related to CPU, memory, swap, disk (including LVM), and network layers, and for each process and thread, such as: CPU utilization, memory growth, disk utilization, priority level, username, status, and exit code.

In addition, atop can also be combined with the kernel module netatop, which can display the network activity of each process and thread.

Install atop:

# apt install atop

Download the netatop source package and unzip it. You need to perform the following steps as root to install the netatop kernel module and netatopd daemon.

# curl -LO https://www.atoptool.nl/download/netatop-3.1.tar.gz
# tar -zxf netatop-3.1.tar.gz
# apt install zlib1g-dev
# cd netatop-3.1
# make
# make install

Load the module and start the daemon:

# systemctl start netatop

Load the module and start the daemon automatically after boot:

# systemctl enable netatop

2. ctop

ctop[^2] is a Go language-based display that provides real-time indicators of multiple containers. Using ctop, you can quickly view the real-time status of container CPU, Memory, Network, IO and other indicators.

# sudo wget https://github.com/bcicen/ctop/releases/download/0.7.6/ctop-0.7.6-linux-amd64 -O /usr/local/bin/ctop
# sudo chmod +x /usr/local/bin/ctop

After the installation is complete, if you execute the ctopcommand prompt and dial unix /var/run/docker.sockreport an error in the pop-up window, the reason is that there is no docker file. You need to use the official installation script to automatically install it. You can execute: curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyunto install docker. After installing docker, you can install it in the /var/run/ directory. Check if the docker.sock file already exists, then you can execute ctop.

2.1 ctop parameter options

  • -a: show only active containers
  • -f <string>: set the initial filter string
  • -h: Display the help dialog
  • -i: Invert the default color
  • -r: Reverse container sort order
  • -s: select the container sort field
  • -v: output version information and exit

3. iftop

iftop[^3] does the same thing for network usage as top does for CPU usage, it listens for network traffic on named interfaces and displays a table of current bandwidth usage by host pair.

# apt install iftop

3.1 iftop parameter options

  • -h: Display help information
  • -n: Do not do hostname lookup
  • -N: Do not convert port numbers to services
  • -p: run in complex mode (shows traffic between other hosts on the same network segment)
  • -b: Do not display the bar graph
  • -B: Display bandwidth in bytes
  • -i interface: Specifies the listening interface
  • -f filter code: Use filter code to select packets to be counted (do not count by default, but only count IP packets)
  • -F net/mask: Display incoming/outgoing IPv4 network traffic
  • -G net6/mask6: Display incoming/outgoing IPv6 network traffic
  • -l: display and count link-local IPv6 traffic (default: off)
  • -P: show port and host
  • -m limit: Set the bandwidth cap
  • -c config file: specify an alternate configuration file
  • -t: use the text interface without ncurses

4. iotop

iotop[^4] is a utility that can identify the processes that are using a lot of I/O requests on your machine, similar to top, but instead of showing you information about what is consuming the most CPU, it is listed by process IO usage related process.

Inspired by Guillaume Chazarain's iotop Python script, rewritten in C by Vyacheslav Trushkin and improved by Boian Bonev, it runs completely without Python.

iotop can run on operating systems of Debian, Ubuntu, Fedora, CentOS 7/8, RHEL 7/8, other Linux distributions.

# apt install iotop

4.1 iotop parameter options

  • --version: Display the version number of the program and exit
  • -h, --help: display help information and exit
  • -o, --only: Show only the process or thread that actually performs the I/O operation
  • -b, --batch: non-interactive mode
  • -n NUM, --iter=NUM: number of iterations until end [infinity]
  • -d SEC, --delay=SEC: iteration interval [1s]
  • -p PID, --pid=PID: monitored processes/threads [all]
  • -u USER, --user=USER: monitored users [all]
  • -P, --processes: show only processes, not all threads
  • -a, --accumulated: Show cumulative I/O, not bandwidth
  • -k, --kilobytes: use kilobytes as a unit
  • -t, --time: add a timestamp to each line
  • -q, --quiet: disable some header lines
  • --no-help: suppress listing of shortcuts

4.2 iotop hotkey

  • any: any other key forces a refresh
  • q:quit
  • i: Change the I/O priority
  • o: show only active processes
  • r: reverse the sort order
  • 方向左右键: change the sort column

Five, nmon

nmon[^5] is a computer performance system monitoring tool for AIX and Linux operating systems that displays local system statistics (CPU, memory, network, disk, Filesystems, NFS, Processes, Resources, etc.), saves statistics to a comma-separated (CSV) data file in a logging format for graphing and analysis to help understand computer resource usage, tuning options, and related bottlenecks.

-FIf you specify any of the , -f, -X, -xand parameter options when running nmon -Z, nmon will be in logging mode, and if you do not add any parameter options nmon will be in interactive mode.

# apt install nmon


For more help information nmon -h, check out nmon's help manual.

Six, slabtop

slabtop[^6] is to display the detailed information of the kernel "slab" buffer in real time.

usage:

slabtop [选项]

Options:

  • -d n--delay=n: Update the displayed information every n seconds, the default is every 3 seconds
  • -o--once: exit after showing once
  • -s S--sort=S: Specify sorting criteria (below) to sort
  • -h--help: display help information
  • -V--version: show the program version

Sort Criteria:

  • a: Sort by the number of active objects
  • b: Sort by objects per slab
  • c: Sort by cache size
  • l: Sort by slabs
  • v: Sort by the number of active slabs
  • n: sort by name
  • o: Sort by number of objects
  • p: Sort by the number of pages in each slab
  • s: Sort by object size
  • u: Sort by cache utilization

Display kernel slab buffer information:

 Active / Total Objects (% used)    : 567933 / 601056 (94.5%)
 Active / Total Slabs (% used)      : 22815 / 22815 (100.0%)
 Active / Total Caches (% used)     : 106 / 175 (60.6%)
 Active / Total Size (% used)       : 160092.21K / 167455.54K (95.6%)
 Minimum / Average / Maximum Object : 0.01K / 0.28K / 8.00K

  OBJS ACTIVE  USE OBJ SIZE  SLABS OBJ/SLAB CACHE SIZE NAME                   
 74382  70996  95%    0.19K   3542       21     14168K dentry
 70005  60472  86%    0.10K   1795       39      7180K buffer_head
 55648  55324  99%    0.50K   3478       16     27824K kmalloc-512
 53376  53376 100%    0.12K   1668       32      6672K kernfs_node_cache
 40192  39937  99%    0.03K    314      128      1256K kmalloc-32
 36231  35951  99%    0.59K   2787       13     22296K inode_cache
 34880  34617  99%    0.20K   1744       20      6976K vm_area_struct
 21951  21711  98%    1.15K    813       27     26016K ext4_inode_cache
 18368  15434  84%    0.06K    287       64      1148K anon_vma_chain
 16170  13296  82%    0.57K   1155       14      9240K radix_tree_node
 15360  15360 100%    0.02K     60      256       240K kmalloc-16
 14848  14848 100%    0.01K     29      512       116K kmalloc-8
 10944  10944 100%    0.06K    171       64       684K kmalloc-64
 10540   8896  84%    0.02K     62      170       248K lsm_file_cache
 10396   8866  85%    0.09K    226       46       904K anon_vma
  9984   6569  65%    0.06K    156       64       624K vmap_area
  9520   9520 100%    0.05K    112       85       448K ftrace_event_field
  9184   7952  86%    0.25K    574       16      2296K filp
  8580   8455  98%    0.66K    715       12      5720K proc_inode_cache
  7956   7755  97%    0.04K     78      102       312K ext4_extent_status
  7014   6173  88%    0.19K    334       21      1336K kmalloc-192
  6720   6720 100%    0.07K    120       56       480K Acpi-Operand
  5696   5436  95%    0.12K    178       32       712K kmalloc-128
  4324   4324 100%    0.09K     94       46       376K trace_event_file

Seven, virt-top

virt-top[^7] is a utility similar to top, mainly used to display the statistics of the virtualization domain and the CPU, memory, virtual disk, virtual network, hypervisor, etc. in the Linux operating system, it needs The use of libvirt to display statistics for different virtualization systems.

virt-top supports installation on CentOS, RHEL, Debian, Ubuntu, Fedora, OpenSUSE and other operating systems.

Install Virt-top on CentOS, RHEL:

# yum install virt-top

Install Virt-top on Debian, Ubuntu:

# apt install virt-top

To install Virt-top on Fedora:

# dnf install virt-top

Install Virt-top on OpenSUSE:

# zypper install virt-top


For more information on the use of virt-top parameter options, please refer to the virt-top man page.

Reference link

[1] atop:https://www.atoptool.nl/index.php
[2] ctop:https://github.com/bcicen/ctop
[3] iftop:http://www.ex-parrot.com/~pdw/iftop/
[4] iotop:https://github.com/Tomas-M/iotop
[5] nmon:http://nmon.sourceforge.net/pmwiki.php
nmon:https://en.wikipedia.org/wiki/Nmon
nmon:https://www.ibm.com/docs/en/aix/7.1?topic=n-nmon-command
[6] slabtop:https://wangchujiang.com/linux-command/c/slabtop.html
[7] virt-top:https://linux.die.net/man/1/virt-top
virt-top:https://www.mankier.com/1/virt-top
virt-top:https://ostechnix.com/display-virtualization-systems-stats-with-virt-top-in-linux/
libvirt:https://libvirt.org/

recent original


That's all for today.

If you think this article is useful to you , please let more friends see it for this article 点个赞, 留个言or read it, because this will be the strongest motivation for me to continue to output more high-quality articles!转发

Guess you like

Origin blog.csdn.net/jake_tian/article/details/122817591