In the next article we are going to take a look at vtop. In the family of tools to monitor from the terminal, we can find top or htop among others, but to this list we can add vtop. This free tool for the terminal written with Node.js, is dedicated to monitor CPU and RAM consumption. It is also open source, simple but powerful and extensible.
Command line tools like 'top' make it difficult to see CPU usage in multithreaded applications (like Apache and Chrome), spikes in time and memory usage. For this reason, your vtop was created.
The program is designed to make it easy for users to see CPU usage in multithreaded applications (those that have a master process and child processes, such as NGINX, Apache, Chrome, etc.). Vtop also makes it easy to see peaks over time, as well as memory usage. The application will use characters Unicode braille (using node-drawille) to draw and display the CPU and memory usage graphs, which will help us to visualize the peaks.
Install vtop on Ubuntu
Before starting to install vtop, it will be necessary that we have Node.js and NPM installed in our system. If you still do not have them available in your system, you can consult the article that we wrote in this blog a while ago, or directly open a terminal (Ctrl + Alt + T) and execute the following commands:
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - sudo apt-get install nodejs
Once our system has Node.js and NPM installed, we are going to execute the following command to install vtop. We will use the command with sudo if it is necessary for the installation of the package:
sudo npm install -g vtop
Use vtop
After installing vtop, to start the tool All you have to do is run the following command in the terminal (Ctrl + Alt + T) to start it:
vtop
In the program interface, we can use keyboard shortcuts to move through it. Some of them are:
- ko up arrow → Move up the process list.
- jo the down arrow → Move down the process list.
- g → It will take us to the top of the process list.
- G → We will go to the end of the list.
- dd → You will kill all processes in that group. But first we must select the name of the process.
- u → It is updated to the latest version of vtop.
For change the color scheme, we can use the modifier –Theme. We will be able to choose any of the available themes; acid, becca, brew, certs, dark, gooey, gruvbox, monokai, nord, parallax, seti, and wizard. If we wanted to use the theme north, the command we would have to write would be:
vtop --theme nord
For set the interval between updates, we will be able to change it with -update-interval and a value in milliseconds. In this example, 20 milliseconds is equivalent to 0.02 seconds:
vtop --update-interval 20
We can also configure vtop to terminate after a few seconds running. To achieve this we are going to use the option –Quit-after as it's shown in the following:
vtop --quit-after 5
If you would like to consult vtop help, in the terminal (Ctrl + Alt + T) you just have to execute the following command:
vtop -h
If you liked vtop, but you keep writing 'top'in the terminal, you can add an alias to ~ / .bashrc. To do this, you just have to edit the file and add the lines at the end of it:
alias top="vtop" alias oldtop="/usr/bin/top"
uninstall
If this program does not convince you, it can be easily uninstalled. You just have to open a terminal (Ctrl + Alt + T) and use the command:
sudo npm remove -g vtop
And if you have also added the alias lines to the file .bashrc, you will have to delete them.
Vtop is another option of the many available with which we can monitor the activity of our system from the terminal. For know more about this tool, users can consult their page on GitHub, or the web page where this tool is presented.