ctop – A Commandline Monitoring Tool For Linux Containers

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

ctop is available in AUR for Arch Linux. So, you can install it using AUR helpers such as Yaourt and Packer. To install these AUR helpers. You don’t need to install both.

After installing any one of the above helpers, install ctop using command:

yaourt -S ctop

Or,

packer -S ctop

For other Linux distributions, download the latest ctop version from the official download page and install it as described below.

wget https://github.com/bcicen/ctop/releases/download/v0.4.1/ctop-0.4.1-linux-amd64 -O ctop
sudo mv ctop /usr/local/bin/
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

ctop usage is fairly easy and straight forward.

You can start monitoring the Containers using command:

ctop

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, ctop might be your 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 social networks and support OSTechNix.

Cheers!

Resource:

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You may also like...