Tools to monitor your Linux systems by command line – part one

Sometimes a system can be slow and many reasons can be the root cause. To identify the process that is consuming memory, disk I/O or processor capacity you need to use tools to see what is happening in an operation system.

There are many tools to monitor a GNU/Linux server. In this article, we will see some *top tools. For example, the top is a popular tool and is installed by default in many Linux distributions, but there are other applications that you should learn, like htop, iotop, sysstat and atop, for example.

top

The  top  program provides a dynamic real-time view of a running system.  It can
display system summary information as well as a list  of  processes  or  threads
currently being managed by the Linux kernel. (from man top)

Installation (on Ubuntu): installed by default on Linux distributions

The top command shows information about a system in a simple way, but there are shortcuts so that you can improve your analysis.

  • c – show full command line of the process;
  • 1 – show all CPU cores;
  • H – show threads;
  • i – show/hide idle tasks;
  • u – filter by a specific user;
  • k – kill a process;
  • d – set update interval to show the information;
  • h – help.

top command

Image 1 of 2

Cursos Online para Auditor de TI do TCU

The ‘í’ command is the most interesting because it shows you only processes that are using resources in your machine. Try it!

More information: man top

htop

It  is  similar to top, but allows you to scroll vertically and horizontally, so you can see all the processes running on the system, along with their full command lines. Tasks  related  to  processes  (killing,  renicing) can be done without entering their PIDs. (from man htop)

Installation (on Ubuntu):

You can see some parameters not shown by the top like task counter and battery. Besides, if you want to monitor your system, the htop process provides a lot of options columns (type htop -> F2 -> go to columns -> Available Columns and you see all options).

htop command

Image 1 of 4

Main shortcuts:

  • F2 – go to setup;
  • F5 – process in a tree view;
  • F6 – select a column to sort;
  • u – filter process by user;
  • P – sort by processor;
  • M – sort by memory;
  • T – sort by time;
  • I – invert sort order;
  • F1 – help.

Unfortunately, I didn’t find an option to hide the idle process.

More information: man htop

Fernando Mariano

Graduated in Computer Engineering and has been working with Systems Administration for 9 years and develops his startup called Enter Concursos.

You may also like...

Leave a Reply