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:
linuxtop command: process monitoring, load, CPU, memory monitoring
linuxdf and du commands: disk monitoring
linuxlsof command: file monitoring
linuxnetstat and tcpdump commands: network monitoring
linuxiotop command: disk I/O monitoring
linuxvmstat 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:
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.