11 Alternatives to the top Command

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

Hello everyone, my name is Jack.

The top command is not unfamiliar to the Linux environment. It checks the overall operation of the system in a real-time and dynamic way, and integrates multi-party information to monitor system performance and operational information. Through the interactive interface provided by the top command, you can use the key to manage.

When introducing the alternative tools for the top command in this article, let's first review the basic syntax, common options, hotkeys during interaction, and example explanations of top, so as to deepen the understanding of top, and hope that it can be further used in practical scenarios. middle.

1. top

1.1 top syntax

top(选项)

1.2 top options

  • -b: operate in batch mode;
  • -c: Display the complete governance command;
  • -d: screen refresh interval;
  • -I: ignore the failure process;
  • -s: secret mode;
  • -S: accumulation mode;
  • -i<time>: set the interval time;
  • -u<username>: Specify the username;
  • -p<process number>: specify the process;
  • -n <number of times>: the number of times of loop display;

1.3 Hotkeys for top interaction

  • h: Display help information and give a brief command summary description prompt;
  • k: terminate a process;
  • i: Ignore idle and zombie processes;
  • q: exit top;
  • r: rearrange the priority level of a process;
  • S: switch to accumulation mode;
  • s: Change the delay time between two refreshes (unit is s), if there is a decimal, convert it to ms. If you enter a value of 0, the system will refresh continuously. The default value is: 5s;
  • f or F: add or delete from the current display;
  • o or O: change the display order;
  • l: Switch to display the average load and startup time information;
  • m: switch to display memory information;
  • t: switch to display process and CPU status information;
  • c: switch to display the command name and the full command line;
  • M: Sort by resident memory size;
  • P: Sort according to the percentage of CPU usage;
  • T: Sort by time or cumulative time;
  • w: write the current settings to the ~/.toprc file;
top - 09:48:47 up 1 day, 10:54,  2 users,  load average: 0.00, 0.02, 0.00
任务: 293 total,   2 running, 291 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.2 sy,  0.0 ni, 99.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :   1945.1 total,    160.5 free,    849.7 used,    934.9 buff/cache
MiB Swap:    923.2 total,    921.4 free,      1.8 used.    904.4 avail Mem

PID USER      PR  NI    VIRT    RES    SHR    %CPU  %MEM     TIME+ COMMAND
6775 root      20   0   21752   4280   3424 R   0.3   0.2   0:05.58 top

1.4 top example explanation

The first line: task queue information

  • top - 09:48:47: Displays the current system time
  • 1 day: The system has been running for 1 day
  • 2 users: 2 users are currently logged in
  • load average: 0.00, 0.02, 0.00: System load, that is, the average length of the task queue. The three values ​​are the average values ​​from 1 minute, 5 minutes, and 15 minutes ago to the present.

The second line: process information

  • Tasks: 293 total: total number of processes
  • 2 running: the number of running processes
  • 291 sleeping: Number of sleeping processes
  • 0 stopped: Number of processes stopped
  • 0 zombie: the number of zombie processes

Third line: CPU information

  • %Cpu(s): 0.0 us: The percentage of CPU occupied by user space
  • 0.2 sy: Percentage of CPU occupied by kernel space
  • 0.0 ni: The percentage of CPU occupied by processes that have changed priorities in user process space
  • 99.8 id: percentage of idle CPU
  • 0.0 wa: percentage of time waiting for input and output CPU
  • 0.0 hi: percentage of CPU occupied by hard interrupts
  • 0.0 si: The percentage of CPU occupied by soft interrupts
  • 0.0 st: used in the case of virtual CPU, used to indicate the CPU time stolen by the virtual machine

Fourth/fifth line: memory information

  • MiB Mem : 1945.1 total: total amount of physical memory
  • 160.5 free: total amount of free memory
  • 849.7 used: total amount of physical memory used
  • 934.9 buff/cache: Amount of memory used for kernel caching
  • MiB Swap: 923.2 total: total amount of swap area
  • 921.4 free: total amount of free swap area
  • 1.8 used: total amount of swap area used
  • 904.4 avail Mem: The amount of physical memory available for the next allocation of the process

Sixth line: Process details

  • PID: Process PID number
  • USER: user
  • PR: priority
  • NI: nice value, negative value means high priority, positive value means low priority
  • VIRT: The total amount of virtual memory used by the process, in KB
  • RES: The size of the physical memory used by the process that has not been swapped out, in KB
  • SHR: Shared memory size, in KB
  • %CPU: The percentage of CPU time from the last update to the present
  • %MEM: percentage of physical memory used by the process
  • TIME+: The total CPU time used by the process, in 1/100 seconds
  • COMMAND: command name/command line

For the original history of top, please refer to: " Top Command Skills You Have to Know "

That's all for a review of the top command. Of course, there is a lot of information in the process details, so I won't introduce them one by one. For the explanations that need to be used in daily study and work, you can refer to the relevant materials for understanding.

However, top has already met the basic conditions for us to troubleshoot related problems in study and work. Next, I will introduce some alternative tools for the top command. Maybe after comparing, you will like these alternative tools more.

2. bashtop

Bashtop[^1] is written based on the Shell language. It is used to display the usage and status of various resources such as the processor, memory, hard disk, network and process of the current Linux operating system. It can be used in Fedora, CentOS 8, RHEL 8, Ubuntu , Debian, FreeBSD, OSX and other operating systems.

2.1 Features of bashtop

  • Easy-to-use, game-inspired menu system;
  • Fast and "mostly" responsive UI with UP, DOWN key process selection;
  • The ability to display detailed statistics of the selected process;
  • Display the current read and write speed of the disk;
  • the ability to filter processes;
  • Easily switch between sorting options;
  • Send SIGTERM, SIGKILL, SIGINT to the selected process;
  • UI menu to change all profile options;
  • Auto-scaling graph of network usage;
  • If a new version is available, it will be displayed in the menu;
  • A variety of data collection methods that can be switched in the Linux environment;

2.2 Installation of bashtop

CentOS 8 installation:

# dnf config-manager --set-enabled PowerTools 
# dnf install epel-release 
# dnf install bashtop

RHEL 8 installation:

ARCH= $( /bin/arch ) 
subscription-manager repos --enable " codeready-builder-for-rhel-8- ${ARCH} -rpms " 
dnf install epel-release 
dnf install bashtop

Ubuntu installation:

# sudo add-apt-repository ppa:bashtop-monitor/bashtop 
# sudo apt update 
# sudo apt install bashtop

The installation is very simple. I am using Ubuntu, so you can install it directly with apt install. If you are using other operating systems, you can refer to: https://github.com/aristocratos/bashtop#installation chapter for installation.

2.3 The use of bashtop

After the installation is complete, bashtopyou can directly execute the command.

# bashtop

The original history of bashtop can be referred to: " An open source Linux resource monitor that dominates GitHub!

3. bpytop

bpytop[^2] is a continuation of bashtop, written based on Python language, mainly used to display the resource monitor of the usage and statistics of the processor, memory, disk, network and process of the current Linux operating system, available on Mac OSX, Arch Linux, Debian, FreeBSD, Fedora, CentOS 8, Ubuntu and other operating systems.

3.1 Features of bpytop

  • Easy-to-use and game-inspired menu system;
  • Full mouse support, all buttons with highlighted keys are clickable, and mouse scrolling works in process list and menu boxes;
  • Fast and responsive UI with UP, DOWN key process selection;
  • The ability to display detailed statistics of the selected process;
  • Ability to filter processes, multiple filters can be entered;
  • Easily switch between sorting options;
  • Send SIGTERM, SIGKILL, SIGINT to the selected process;
  • UI menu for changing all profile options;
  • Auto-scaling graph of network usage;
  • Display a message in the menu if a new version is available;
  • Display the current read and write speed of the disk;

3.2 Installation of bpytop

Mac OSX installation:

# brew install bpytop

Fedora/CentOS 8 installation:

# sudo dnf install bpytop

Debian/Ubuntu installation:

# sudo apt install bpytop

The installation is very simple. I am using Ubuntu, so you can install it directly with apt install. If you are using other operating systems, you can refer to: https://github.com/aristocratos/bpytop#installation chapter for installation.

3.3 Use of bpytop

After the installation is complete, bpytopyou can directly execute the command.

$ bpytop -lc


More bpytop command line options

usage: bpytop [-h] [-b BOXES] [-lc] [-v] [--debug]

optional arguments:
  -h, --help            show this help message and exit
  -b BOXES, --boxes BOXES
                        which boxes to show at start, example: -b "cpu mem net proc"
  -lc, --low-color      disable truecolor, converts 24-bit colors to 256-color
  -v, --version         show version info and exit
  --debug               start with loglevel set to DEBUG overriding value set in config

The original history of bpytop can be referred to: " A Linux resource monitor based on Python language!

4. btop

btop[^3] is based on the C++ language and is mainly used to display the resource monitor of the usage and statistics of the processor, memory, disk, network and process of the current Linux operating system.

4.1 Features of btop

  • Easy-to-use, game-inspired menu system;
  • Support for mouse All buttons with highlighted keys are clickable, and mouse scrolling works in process list and menu boxes;
  • Fast and responsive UI with UP, DOWN key process selection;
  • The ability to display detailed statistics of the selected process;
  • the ability to filter processes;
  • Easily switch between sorting options;
  • tree view of the process;
  • Send any signal to the selected process;
  • UI menu for changing all profile options;
  • Auto-scaling graph of network usage;
  • Display disk IO activity and speed;
  • battery fuel gauge;
  • optional symbols for the chart;

4.2 Installation of btop

# snap install btop

The installation is very simple. I am using Ubuntu, so it can be installed directly with snap install. If you are using other operating systems or installing in other ways, please refer to: https://github.com/aristocratos/btop#installation chapter to install.

4.3 Use of btop

After the installation is complete, btopyou can directly execute the command.

# btop


More bpytop command line options

usage: btop [-h] [-v] [-/+t] [-p <id>] [--utf-force] [--debug]

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show version info and exit
  -lc, --low-color      disable truecolor, converts 24-bit colors to 256-color
  -t, --tty_on          force (ON) tty mode, max 16 colors and tty friendly graph symbols
  +t, --tty_off         force (OFF) tty mode
  -p, --preset <id>     start with preset, integer value between 0-9
  --utf-force           force start even if no UTF-8 locale was detected
  --debug               start in DEBUG mode: shows microsecond timer for information collect
                        and screen draw functions and sets loglevel to DEBUG

The above three open source top alternative tools can be said to be the three Musketeers of Jakob P. Liljenberg.

Five, bottom

bottom[^4] is a customizable cross-platform graphical process/system monitor for the terminal, supporting Linux, macOS and Windows.

5.1 Features of bottom

  • CPU usage over time, average and per core level;
  • RAM and swap usage over time;
  • network I/O usage over time;
  • Support zoom in or zoom out the current time interval displayed;
  • Support to display information about disk capacity, usage, temperature sensor, battery usage;
  • Supports widgets to display, sort, search information about processes (CPU, memory, network, process, disk, temperature, battery);
  • Support for customizable behavior controlled using command line flags or configuration files (custom and pre-built color themes, changing the default behavior of some widgets, changing the layout of the widgets, filtering out entries in the disk and temperature widgets);
  • Support key and mouse binding related shortcut keys;

5.2 Installation of bottom

It can be installed on Arch Linux, Debian/Ubuntu, Fedora/CentOS platforms or in various ways.

# curl -LO https://github.com/ClementTsang/bottom/releases/download/0.6.6/bottom_0.6.6_amd64.deb 
# sudo dpkg -i bottom_0.6.6_amd64.deb

For more installation methods, please refer to: https://github.com/ClementTsang/bottom#installation section for installation.

5.3 Use of bottom

After the installation is complete, execute the btmcommand

# btm

6. glances

Glances[^5] is a cross-platform monitoring tool based on the Python language. It aims to present a large amount of system monitoring information through curses or a web-based interface. The information can be dynamically adjusted according to the size of the user interface. It is a GNU/Linux, Alternative to top/htop for BSD, Mac OS and Windows operating systems.

It can work in client/server mode, remote monitoring can be done via terminal, web interface or API (XML-RPC and RESTful), statistics can also be exported to files or external time/value databases.

In addition to listing all processes and their CPU and memory usage, it can also display other information about the system, such as:

  • Network and Disk Usage
  • Filesystem used and total space
  • Data from different sensors (e.g. battery)
  • and a list of processes that have recently consumed excessive resources

6.1 Installation of glances

# apt install glances

For more installation methods, please refer to: https://github.com/nicolargo/glances#installation for installation.

6.2 Use of glances

Standalone mode simply execute:

# glances


Web server mode executable:

# glances -w

Use the web interface to monitor the local machine and start the RESTful server to http://0.0.0.0:61208/start browsing the web server.

Client/Server mode executable:

# glances -s

on the server side and run:

# glances -c <ip_server>

See help for more glances usage, optional parameter options, and use-case executable commands glances -h.

Seven, gotop

gotop[^6] is written in Go and is a terminal-based graphical activity monitor that runs on Linux, FreeBSD and macOS.

7.1 Installation of gotop

# snap install gotop

7.2 Use of gotop

After installation, just execute the command gotop, more hotkeys can be found in the usage section of the GitHub repository​.

Eight, gtop

gtop[^7] is a terminal system monitoring dashboard written in JavaScript language.

8.1 gtop installation

# apt install npm
# npm install gtop -g

8.2 Use of gtop

After the installation is complete, execute the command gtop. To stop gtop, use the qkey or Ctrl+c.

# gtop

Nine, htop

htop[^8] can be said to be an excellent alternative to top. It is written in C and is a cross-platform interactive process monitoring tool. It has better visual effects and is easier to understand the current system status at a glance. Allows vertical and horizontal scrolling of the process list to view their full command line and related information such as memory and CPU consumption. System-wide information such as load average or swap usage is also displayed.

The information displayed is configurable through graphical settings, and can be interactively sorted and filtered, and process-related tasks such as termination and reprocessing can be done without entering its PID.

Installation is also simple, just execute the command and it's apt install htopdone.

10. nvtop

Nvtop[^9]: NVidia TOP, a (h)top-like task monitor for NVIDIA GPUs that can handle multiple GPUs and print information about them in a way that htop is familiar with.

Ubuntu disco (19.04) / Debian buster (stable)

# sudo apt install nvtop


More nvtop command line options

# nvtop -h
nvtop version 1.1.0
Available options:
  -d --delay        : Select the refresh rate (1 == 0.1s)
  -v --version      : Print the version and exit
  -s --gpu-select   : Colon separated list of GPU IDs to monitor
  -i --gpu-ignore   : Colon separated list of GPU IDs to ignore
  -p --no-plot      : Disable bar plot
  -r --reverse-abs  : Reverse abscissa: plot the recent data left and older on the right
  -C --no-color     : No colors
  -N --no-cache     : Always query the system for user names and command line information
  -f --freedom-unit : Use fahrenheit
  -E --encode-hide  : Set encode/decode auto hide time in seconds (default 30s, negative = always on screen)
  -h --help         : Print help and exit

Eleven, vtop

vtop[^10] is a command-line graphical activity monitor that uses drawille to draw CPU and memory charts with Unicode braille characters, display them visually, and group processes with the same name together, Installation is also simple, just execute the command and it's npm install -g vtopdone.

To run just execute the command vtop.

  • dd: kill all processes in this group
  • Press the down arrow or jkey to move down
  • Press the up arrow or kkey to move up the process list
  • Press keyg to go to the top of the process list
  • keyG to move to the end of the list
  • Keysc to sort by CPU
  • Keysm to sort by memory

12. Zenith

zenith[^11] is a Rust-based terminal graphics with scalable charts, CPU, GPU, network and disk usage.

12.1 Characteristics of zenith

  • Optional graphs of CPU, memory, network and disk usage
  • Support browsing disk free space, NIC IP address, CPU frequency
  • Users with support for displaying CPU, memory and disk
  • Battery percentage, charge or discharge time, power used
  • Filterable process table similar to top, including disk usage per process
  • Change process priority
  • Zoomable chart view (supports timely rollback)
  • Using Signal Management Processes
  • Performance data saved between runs
  • GPU utilization metrics for NVIDIA GPUs (with --features nvidia), including per-process GPU utilization
  • Disk free space chart

12.2 Installation of zenith

I installed zenith from the deb package, but the latest 64-bit deb package requires a Debian >= 9 or Ubuntu >= 16.04 based distribution to install.

# curl -LO https://github.com/bvaisvil/zenith/releases/download/0.12.0/zenith_0.12.0-1_amd64.deb
# dpkg -i zenith_0.12.0-1_amd64.deb

For other installation methods, please refer to: https://github.com/bvaisvil/zenith#installation section.

12.3 Use of zenith

After installing zenith, running zenith without any parameters will start with default visualizations for CPU, disk and network and a refresh rate of 2000 ms (2 seconds).

# zenith


More zenith command line options

Usage: zenith [OPTIONS]

Optional arguments:
  --disable-history          Disables history when flag is present (default: false)
  -h, --help
  -V, --version
  -c, --cpu-height INT       Min Percent Height of CPU/Memory visualization. (default: 17)
  --db STRING                Database to use, if any.
  -d, --disk-height INT      Min Percent Height of Disk visualization. (default: 17)
  -n, --net-height INT       Min Percent Height of Network visualization. (default: 17)
  -p, --process-height INT   Min Percent Height of Process Table. (default: 32)
  -r, --refresh-rate INT     Refresh rate in milliseconds. (default: 2000)
  -g, --graphics-height INT  Min Percent Height of Graphics Card visualization. (default: 17)

References

[1] bashtop:https://github.com/aristocratos/bashtop
[2] bpytop:https://github.com/aristocratos/bpytop
[3] btop:https://github.com/aristocratos/btop
[4] bottom:https://github.com/ClementTsang/bottom
[5] glances:https://github.com/nicolargo/glances
[6] gotop:https://github.com/cjbassi/gotop
[7] gotop:https://github.com/xxxserxxx/gotop
[8] gtop:https://github.com/aksakalli/gtop
[9] htop:https://github.com/htop-dev/htop
[10] nvtop:https://github.com/Syllo/nvtop
[11] vtop:https://github.com/MrRio/vtop
[12] zenith:https://github.com/bvaisvil/zenith

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/122781166