System monitoring is an incredible tool for any Linux user or system administrator. It allows you to view what processes are consuming the system resources and why. It also allows you to terminate the processes as you fit to release system resources.
In this tutorial, we will explore how you can use the gtop command in Linux to monitor your system usage.
What is gtop?
gtop is a free and open-source terminal based dashboard that allow you to visualize system usage straight from your terminal window. It provides a very user friendly interface for visualizing your resources. You can view Memory usage, CPU utilizations, disk usage, etc. in a very easy to read dashboard.
gtop vs. htop
Gtop is built on the precedent of htop, which aims to be a more interactive and graphical version of top. If you are unfamiliar, top is a command included by default on most Unix systems for viewing running processes and system usage information. Htop adds vertical and horizontal scrolling, mouse input, more information about processes, and additional features.
Gtop takes up the graphical direction of htop. But unlike htop, which still focuses on listing processes, gtop seeks to provide an almost entirely graphical representation of the system's usage information. With gtop, you get various graphs in widgets that break up your monitoring into visual sections. Gtop employs distinct coloring in its displays, making it all the more readable, too.
Take a look at the screenshots below, which contrast the displays of top, htop, and gtop.
How to Install gtop
In order to install gtop you need to instal the Node Package Manager (npm). This section shows you how to install npm, using the Node Version Manager (nvm), and then, how to install gtop.
You can use the following commands to install nvm and then use it to install the current version of Node (which includes npm). You may want to consult the nvm installation guide and replace
v0.38.0 below with the latest version you see in the guide.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bashsource ~/.bashrc nvm install node
You can then verify your npm installation with using the
npm --version 8.12.1
Install gtop using npm. Use the
-g option to install gtop as a global system package.
npm install gtop -g
How to Use gtop
One advantage of gtop is that, despite its graphical display, it is a straight-forward system monitoring application. When you run gtop it immediately starts showing your system's usage and process information.
What follows is a breakdown of the parts, or widgets, of the gtop display.
- CPU History displays a graph of CPU usage over the last minute. Each line on the graph represents one of your system's CPUs. In addition, the right side of the widget includes the current percentage usage for each CPU.
- Memory and Swap History provides the same graphical information but for your system's memory, both physical and swap.
- The Memory and Swap widgets display the current percentage usage for physical memory and swap memory, respectively.
- Network History shows information related to network traffic and includes a graph of bytes-per-second being received over the last minute.
- The Disk Usage widget displays the current percentage of disk usage on the system.
- Processes gives you a simplified version of the process listing you could expect from the
Gtop is limited in its interactive options. You can navigate the Processes table with the up and down arrow keys. You can also control the table's sort order. Press p key to sort by PID (process ID), c key to sort by CPU usage, and m key to sort by memory usage.
For all its simplicity, gtop provides an effective at-a-glance summary of your system. Tools like top and htop focus on providing more comprehensive information about running processes — and, in the case of htop, more control of those processes. Gtop excels if you want to be able to quickly gather your system's current performance.