gotop - A Tool to Monitor System Activity in Linux

Every Linux administrator has it's own preferences on how to monitor processes in terminal. And you probably know about tools like top and htop. These are tools for process monitoring in terminal without any visualization. And you probably know about gtop and vtop which are also process monitoring terminal tools, but with visualization. In this article, we are going to install and use another terminal based graphical activity monitor called gotop. Unlike the two mentioned above, gotop is written in Go. We are going to cover the following topics:

  • How to install gotop on different Linux distributions (CentOS 7, Ubuntu 18.04 and ArchLinux)
  • How to use gotop

Installation on Ubuntu 18 and CentOS 7

The process of installing gotop on your machine running Ubuntu 18 or CentOS 7 is absolutely the same. As gotop is an open source project and has repo on GitHub, we can use git to clone the repo on our machine and run it. Make sure you have git installed on your machine and run the following command:

git clone --depth 1 https://github.com/cjbassi/gotop.git /tmp/gotop

Then run the download.sh to download the correct binary

/tmp/gotop/download.sh

Binary file will be downloaded to your working directory. After the correct binary has been downloaded we need to move gotop into our $PATH. To do this, at first we need to view our $PATH with the following command:

echo $PATH

Output will be like the one below

/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/linoxide/.local/bin:/home/linoxide/bin

and the move gotop into our $PATH somewhere

sudo mv gotop /usr/local/bin/

That's all. Now you can run the tool just typing gotop in your terminal. Later in this article we will discuss usage of gotop.

Installation on Arch Linux

For Arch Linux there is another way to install gotop. You need to install gotop-bin package from AUR. To do this we need to find snapshot download URL of gotop-bin package on AUR website. Open the website, search for the desired package and find "Download snapshot". Right click on the link and copy link address. Then, using wget command, download the snapshot. In gotop's case that command will look like the following:

 wget https://aur.archlinux.org/cgit/aur.git/snapshot/gotop-bin.tar.gz

Uncompress the downloaded tar.gz file using the following command:

tar -xvzf gotop-bin.tar.gz

and change the working directory to newly created one:

cd gotop-bin

Use the following command to compile the package:

makepkg -s

After compile, you will have file with .xz extension in your directory. Type ls to view the content of the directory. The output will look like this:

gotop_1.2.10_linux_amd64.tgz gotop-bin-1.2.10-1-x86_64.pkg.tar.xz pkg PKGBUILD src

Now you can install gotop with the following command:

sudo pacman -U gotop-bin-1.2.10-1-x86_64.pkg.tar.xz

Installation looks like bit harder if you are new to Arch Linux, but it's way easier than it looks like.

How to use gotop

If you have installed gotop on your system, you can type gotop command to open it. This command will open gotop with it defaults. Output would be like in the screenshot below

gotop

But for comfortable usage of gotop there is a bunch of different commands. For example, to view only CPU, memory and process widgets you can type:

gotop -m

or

gotop --minimal

gotop -m

You can set different color scheme while running gotop with -c flag. Color schemes are located in colorschemes directory of the repo folder (in our case this folder is /tmp/gotop/colorschemes). For example:

gotop -c solarized

gotop -c solarized

If you are using Linux with GUI then mouse actions like click and scroll are working in processes widget. You can click on the process to select it or scroll through processes. Also gotop has handy keybinds to use. While gotop is running you can navigate through processes with UP and DOWN or j and k buttons.

Press gg to jump to top and G to jump to bottom.

Ctrl+d and Ctrl+u will jump up and down half a page in processes widget. Ctrl+f and Ctrl+b will do the same but a full page.

To sort processes you can press c, m or p. These will sort by CPU, memory and process count/or PID appropriately.

Tab button will toggle process grouping. This means you can view processes PIDs as well as process count for process group.

To kill the selected process or process group type dd command.

To zoom in and out CPU and mem graphs, press h and l appropriately.

There is no need to remember all these keybinds, because you can just press ? on your keyboard and all available keybinds will appear on your screen.

To quit gotop you can use Ctrl+c or q buttons.

Read Also :

Conclusion

gotop as its similar tools is very easy to install and manage. It gives useful realtime information and can help system administrators with first level troubleshooting. But the main problem of this kind of tools is that don't store data anywhere. Thus, they don't have history. If you've closed the tool, you can't view the data for minute ago.

Hayk Gevorgyan 12:57 am

About Hayk Gevorgyan

Technical Support Engineer experienced in Linux servers administration of production environments. Exploring DevOps culture and tools. Interested in containerization and open source monitoring tools.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.