Ctop – A Commandline Monitoring Tool For Linux Containers
A while ago, we have written about a tool called “Portainer”, a web-based Docker management tool. Using Portainer, we can easily create, delete, and manage containers. In this guide, we will see how to monitor those Linux containers from commandline using “ctop”. It is a simple utility like ‘top’ command, which is used to display the running processes. Using ctop, you can easily monitor the Linux containers right from your Terminal. It comes with built-in Docker support, and provides a compact overview of multiple containers.
In this brief guide, we will see how to install and use it in Linux.
Install ctop on Linux
$ yay -S ctop
For other Linux distributions, download the latest ctop version from the official download page and install it as described below.
$ sudo wget https://github.com/bcicen/ctop/releases/download/v0.7.2/ctop-0.7.2-linux-amd64 -O /usr/local/bin/ctop
$ sudo chmod +x /usr/local/bin/ctop
Also, you can install and run it via Docker. To do so, you need to install Docker on your Linux machine. Refer the following links to install Docker on CentOS and Ubuntu.
Once you installed Docker, run ctop like below.
$ docker run -ti -v /var/run/docker.sock:/var/run/docker.sock quay.io/vektorlab/ctop:latest
We have now installed ctop. It’s time to see how to use it.
ctop usage is fairly easy and straight forward.
You can start monitoring the Containers using command:
If there are any containers running in your system, you will see an output something like below.
Here, you can view the list of running containers, and its CPU and memory usage, and Transmit(TX) and receive(RX) metrics.
Press ‘a’ to toggle between running and non-running containers. To display the help section, press ‘h’. To quit ctop, press ‘q’. Here is the complete list of ctop function keys.
- a – Toggle display of all (running and non-running) containers
- f – Filter displayed containers
- H – Toggle ctop header
- h – Open help section
- s – Select container sort field
- r – Reverse container sort order
- q – Quit ctop
ctop is just a basic, yet fully functional monitoring tool for Linux containers. It does exactly what it says on the official website. If you’re looking for a simple commandline monitoring options for your containers, ctop might be a good choice.
You might want to download our free Docker Ebooks.
And, that’s all for today. If you find this guide useful, share it on your professional and social networks and support OSTechNix.
More good stuffs to come. Stay tuned!