Troubleshoot several common Linux commands on online issues https://www.cnblogs.com/cjsblog/p/9562380.html
Top
Equivalent to Windows Task Manager
You can see that the output is divided into two parts, the first 5 rows is the overview, the following is the specific process resource usage. Take a look at the following line
Line 1th
top-18:14:58 up, 1:35, 1 user, load average:0.00, 0.10, 0.11
In turn, the current time, the time the system has been running, the number of users currently logged on, the system in the last 1 minutes, 5 minutes, 15 minutes of load
(PS:
From this line we can know the following information
Current time is 18:14:58
The system has been running for 112 days, 1 hours, 35 minutes.
There are currently 1 users logged in
In the last 1 minutes, 5 minutes, 15 minutes of load were 0.00, 0.10, 0.11
Load exceeding 1 means overload
)
Line 2nd
tasks:225 Total, 1 running, 224 sleeping, 0 stopped, 0 zombie
Process information
Total process Totals
Number of processes running in running
Sleeping the number of processes in sleep
Stopped number of processes stopped
Zombie Number of zombie processes
(PS: From this line we can know, currently a total of 225 processes)
Line 3rd
Cpu (s): 1.8%us, 0.9%sy, 0.0%ni, 97.1%id, 0.1%wa, 0.0%hi, 0.1%si, 0.0%st
CPU Usage
US: User process consumes CPU percentage
SY: Kernel process consumes CPU percentage
NI: process that has changed precedence consumes CPU percentage
ID: Percentage of idle CPU
Wa:io The waiting process consumes CPU percentage
Hi: Percentage of hard interrupts consuming CPU
Si: The percentage of CPU that the soft interrupt consumes
St:
Line 4th
mem:32879852k Total, 23633040k used, 9246812k free, 311552k buffers
Physical Memory usage
Total Memory Size
Used already in use
Free not used
Buffers Kernel buffers
Available memory = Free + buffers + Cached
Line 5th
swap:4194300k Total, 255104k used, 3939196k free, 10422508k cached
Virtual Memory usage
Remaining rows
Free-m
View used and unused memory conditions
Mem total = used + Free
Swap total = used + Free
Available memory = Free + buffers + Cached
(-buffers/cache) Number of used memory = used–buffers–cached in mem line
(+buffers/cache) Free memory = Free + buffers + cached in mem line
Iostat
Format: iostat [Options] [ <时间间隔> [ <次数> ]]
Example:
Iostat-d
Iostat-d 2 2
Iostat-x 1 2
Netstat
To pay special attention to the number of "established", if the more established, the more connections established, if always high, then it is necessary to pay attention, because the system to open the number of connections is limited.
Common applications:
1. View the IP with the highest number of connections
Netstat-na | grep established | awk ' {print $} ' | Awk-f: ' {print $} ' | Sort | Uniq-c
2. Count the number of connections in different states of TCP
Netstat-na | awk '/^tcp/{++s[$NF]} END {for (a in S) print A, s[a]} '
Df-h
View file system disk space usage
Du-sh
View (calculate) file size
I can do that.
Du--max-depth=2--block-size=m
Or
ll--block-size=m
Other related
Maximum number of Linux system open files limit
Linux command troubleshooting a few common issues on the line