Linux Monitor Commands

No matter what operating system or production system, it will provide some necessary monitoring capabilities to understand and control the overall system. Similarly, the Linux system also provides some monitoring commands.

Commonly used monitoring commands in Linux system are:

  • linux top command: process monitoring, load, CPU, memory monitoring
  • linux df and du commands: disk monitoring
  • linux lsof command: file monitoring
  • linux netstat and tcpdump commands: network monitoring
  • linux iotop command: disk I/O monitoring
  • linux vmstat command: virtual memory statistics

top – linux process monitoring

Linux Top command is a performance monitoring program that can display CPU usage, memory usage, swap memory, cache size, buffer size, process PID, users, commands, etc. The top command is used to display all running and active real-time processes in an ordered list and update them regularly. It can also sort the processes of running processes according to memory or CPU utilization.

The top command is useful for system administrators to monitor and take corrective measures when needed. In the following example, let us look at the linux top command:

➜  ~ top

For more examples of linux top command read: Linux top command tutorial: top syntax and top examples

df – disk usage space monitoring command

Linux df command is mainly used to monitor the volume space usage of the disk mount, it can list all the available disk space of the current system.

➜  ~ df -h

For more examples of linux df command read: df command tutorial in linux/unix with examples and use cases

du – file usage space monitoring command

Linux du command can display the space usage of all files or folders in the current directory.

➜  ~ du -sh *

For more examples of linux du command read: du command tutorial in linux/unix with examples and use cases

lsof – list open files

Linux lsof command is used to display a list of all open files and processes. The included open files include disk files, network sockets, pipes, devices, and processes. With this command, you can easily identify the files you are using.

➜  ~ lsof

netstat – network statistics

Linux netstat command is a command-line tool for monitoring the packets entering and leaving the network and network interface statistics. It is very useful for monitoring network performance and solving network-related problems.

➜  ~ netstat -anp

tcpdump – network packet analyzer

Linux tcpdump command is used to capture or filter TCP/IP packets received or transmitted on a specified interface on the network.

➜  ~ sudo tcpdump -i ens33

iotop – monitor linux disk I/O

Linux iotop command is used to monitor linux disk I / O and find a large number of disk read and write processes.

➜  ~ iotop

vmstat – virtual memory statistics

Linux vmstat command is used to display statistics of virtual memory, kernerl threads, disks, system processes, I/O blocks, interrupts, CPU activity and much more. It is generally completed by two numeric parameters, the first parameter is the sampling interval, the unit is seconds; the second parameter is the number of samples.

➜  ~ vmstat 3 5