How to check resource usage on Linux?
In a Linux system, you can use the following commands to check resource usage:
- top command: displays real-time resource usage of each process in the system, including CPU usage, memory usage, number of processes, etc. Sort order and displayed columns can be configured as needed.
- The free command displays information about the system’s memory usage, including total memory, used memory, and free memory.
- vmstat command: displays system statistics such as virtual memory, processes, and I/O, including CPU usage, memory usage, and disk I/O.
- iostat command: displays the system’s disk I/O usage, including disk read/write speeds, disk queue length, and more.
- The netstat command displays the system’s network connection status, including TCP connections, UDP connections, inter-process communication, etc.
- sar command: display historical data on the system’s resource usage, including CPU usage, memory usage, disk I/O, etc.
Here are some common commands for checking resource usage, choose the appropriate one as needed.