Skip to content

Useful Linux Commands to monitor CPU and Memory resources on server

There are several Linux commands that can be used to gather information about the CPU  and Memory in a Linux system. Some of the most commonly used commands include:

To displays information about the CPU architecture, clock speed, and other details about each core in the system.

$ cat /proc/cpuinfo

To provides a summary of the CPU architecture, including the number of CPUs, cores, and threads, as well as clock speed and other details.

$ lscpu

 

To provides real-time information about the system’s CPU usage, including the percentage of CPU usage for each process, as well as the total CPU usage.

$ top

 

htop is Similar to top but it provides more detailed information and a more user-friendly interface.

$ htop

 

To provides detailed statistics about CPU usage, including the average usage for each core, as well as individual statistics for each core.

$ mpstat -P ALL

 

To list all running processes and their associated process IDs. You can use the -C option to filter the output by the command name and -o %cpu to sort the output by the CPU usage.

$ ps -C firefox -o %cpu

 

To provide detailed statistics about memory usage and CPU usage, including the number of processes in the run queue and the amount of free memory.

$ vmstat

 

To provide statistics on input/output operations, including the number of reads and writes, as well as the average response time and the amount of data transferred.

$ iostat

To provide system activity information, including CPU usage, memory usage, I/O activity, and network activity.

$ sar -u

To provide detailed statistics about process-level CPU usage, including the average usage for each process and the number of system calls made by each process.

$ pidstat -u

To show the number of processors or cores in your system.

$ nproc

To provide information about the system’s memory usage, including the amount of free and used memory, as well as the amount of memory used by the system cache and buffers.

$ free

To show the system uptime, the number of users currently logged in, and the system load averages for the past 1, 5, and 15 minutes.

$ uptime

To provide detailed information about the system’s hardware, including the CPU, memory, storage, and network devices.

$ lshw

 

To provides information about the system’s GPU, including the GPU model, memory, and driver version, which can be useful if you are running applications that rely heavily on the GPU.

$ glxinfo

 

To provide an overview of system performance, including CPU usage, memory usage, disk I/O, and network activity.

$ dstat

 

To provide a detailed view of system performance, including CPU usage, memory usage, and disk I/O. It also shows the top processes by CPU and memory usage.

$ atop

 

To provide information about disk I/O usage, including the processes that are using the most I/O and the amount of data being transferred.

$ iotop

 

To provide a detailed view of a process’s memory usage, including the amount of memory used by the process’s code, data, and shared libraries.

$ pmap pid

 

To find the process ID of a running process by name.

$ pgrep processname

 

To provide detailed performance metrics, including CPU, memory, disk I/O, network, and filesystem statistics.

$ nmon

 

To provide detailed information about the system’s CPU, including the clock speed, temperature, and power usage.

$ turbostat

 

 

Brijesh Gogia
Leave a Reply