cTop – Command Line tool for container monitoring and management in Linux

Recent days Linux containers are famous, even most of us already working on it and few of us start learning about it.

We have already covered article about the famous GUI (Graphical User Interface) tools such as Portainer & Rancher. This will help us to manage containers through GUI.This tutorial will help us to understand and monitor Linux containers through cTop command. It’s a command-line tool like top command.

What is cTop

ctop provides a concise and condensed overview of real-time metrics for multiple containers. It’s Top-like interface for container metrics.

It displays containers metrics such as CPU utilization, Memory utilization, Disk I/O Read & Write, Process ID (PID), and Network Transmit(TX – Transmit FROM this server) and receive(RX – Receive TO this server).

ctop comes with built-in support for Docker and runC connectors for other container and cluster systems are planned for future releases.It doesn’t requires any arguments and uses Docker host variables by default.

Suggested Read :
(#) Portainer – A Simple Docker Management GUI
(#) Rancher – A Complete Container Management Platform For Production Environment
(#) Dry – An Interactive CLI Manager For Docker Containers

How to install cTop

Developer offers a simple shell script, which help us to use ctop instantly. What we have to do is, just download the ctop shell file at /bin directory for global access. Finally assign the execute permission to ctop shell file.

Download the ctop shell file @ /usr/local/bin directory.

$ sudo wget https://github.com/bcicen/ctop/releases/download/v0.7/ctop-0.7-linux-amd64 -O /usr/local/bin/ctop

Set execute permission to ctop shell file.

$ sudo chmod +x /usr/local/bin/ctop

Alternatively you can install and run ctop through docker. Make sure you should have installed docker as a pre-prerequisites for this. To install docker, refer the following link.

Suggested Read :
(#) How to install Docker in Linux
(#) How to play with Docker images on Linux
(#) How to play with Docker containers on Linux
(#) How to Install, Run Applications inside Docker Containers

$ docker run --rm -ti \
  --name=ctop \
  -v /var/run/docker.sock:/var/run/docker.sock \

How to use cTop

Just launch the ctop utility without any arguments. By default it’s bind with a key which display of all containers (running and non-running). ctop header shows your system time and total number of containers.

$ ctop

You might get the output similar to below.

How to manage containers

You can able to administrate the containers using ctop. Select a container that you want to manage then hit Enter button and choose required options like start, stop, remove, etc,.

How to sort containers

By default ctop sort the containers using state field. Hit s key to sort the containers in the different aspect.

How to view the containers metrics

If you want to view more details & metrics about the container, just select the corresponding which you want to view then hit o key.

How to view container logs

Select the corresponding container which you want to view the logs then hit l key.

Display only active containers

Run ctop command with -a option to show active containers only.

Open Help dialog box

Run ctop, just hit hkey to open help section.

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

Leave a Reply

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