Home > Article > Operation and Maintenance > Let me summarize for you how to check the status of memory, disk, CPU and network in Linux
This article brings you relevant knowledge about how to check the memory, disk, cpu and network io in Linux. I hope it will be helpful to you.
Today’s focus:
① Learn to check various statuses of Linux, including: network IO, disk, CPU, memory, etc.;
② Learn to understand the meaning of commands and quickly discover problems in the cluster.
linux monitors network IO, disk, CPU, memory:
(1) Memory : number of strips, size of each strip, whether the memory is DDR4 or DDR3, memory Is the frequency 2666MT/S or 1600MT/s
number of entries: dmidecode|grep -A5 'Memory Device'|grep Size | grep -v Installed |wc -l
Size of each item: dmidecode|grep -A5 'Memory Device'|grep Size | grep -v Installed |uniq
Memory type: dmidecode | grep -A16 "Memory Device" | grep 'Type:' | grep -v Unknown | uniq
Memory frequency: dmidecode | grep -A16 "Memory Device" | grep 'Speed' | grep -v Unknown |uniq
(2) Hard disk: number of blocks, size
fdisk -l | grep "Disk /dev/sd"
(3) Check what process occupies the port
netstat -antp | fgrep
(4) Check the process resources
(5) Number of CPUs
cat / proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
(6)CPU core number
cat /proc/cpuinfo| grep "cpu cores"| uniq
(7) CPU frequency
cat /proc/cpuinfo| grep "model name"| uniq
ps command is used to view the process status in the system
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
● USER, the user name of the process owner.
● PID, process number, can uniquely identify the process.
● %CPU, the CPU time occupied by the process since the last refresh and the percentage of the total time.
● %MEM, the percentage of memory used by the process.
● VSZ, the virtual memory size used by the process, in K.
● RSS, the total amount of physical memory occupied by the process, in K.
● TTY, process-related terminal name.
● STAT, process status, used (R--running or ready to run; S--sleep state; I--idle; Z--frozen; D--uninterrupted sleep; W-process has no resident pages; T stop or track.) these letters to represent.
● START, the time when the process starts running.
● TIME, the total CPU time used by the process.
● COMMAND, the command line to be executed.
3.2. Top
#The top command is a commonly used performance analysis tool under Linux, which can display the resource usage of each process in the system in real time, similar to Windows Task Manager.
1. The upper part shows the overall system load:
2. The lower part shows the running status of each process:
【Message from Tomatoes】
1. Don’t panic when you encounter problems. Based on experience, you can then use commands to troubleshoot memory, disk, network, and CPU. The problems are just in these categories. You must not make changes in a hurry to complicate simple problems.
2. According to the above command, set the monitoring warning in advance. Monitoring and early warning can allow you to discover system performance information in time, such as the disk is almost full or the memory is overloaded. We can make adjustments in advance.
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of Let me summarize for you how to check the status of memory, disk, CPU and network in Linux. For more information, please follow other related articles on the PHP Chinese website!