top
Equivalent to Windows Task Manager
As you can see, the output is divided into two parts, the first five lines are the overview, the following is the specific process resource usage.Look at the following line by line.
First lines
top – 18:14:58 up 112 days, 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 in, the system in the past 1 minute, 5 minutes, 15 minutes of load
(PS:
From this line, we can know the following information
- The current time is 18:14:58.
- The system has been running for 112 days, 1 hours and 35 minutes.
- There are currently 1 users logging in.
- In the past 1 minutes, 5 minutes, 15 minutes of load were 0, 0.10, 0.11
Over 1 load means overload.
)
Second lines
Tasks: 225 total, 1 running, 224 sleeping, 0 stopped, 0 zombie
Process information
- total Total process
- running Number of processes in operation
- sleeping Number of processes in sleep
- stopped Number of processes stopped
- zombie zombie
(PS:From this line, we can see that there are currently 225 processes.)
Third lines
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
CPUUsage
us : User process occupying CPU percentage
sy : The kernel process takes up CPU percentage.
ni : Changes in priority process occupy CPU percentage
id : Percentage of idle CPU
wa : IOThe waiting process takes up CPU percentage.
hi : Percentage of hard interrupt occupying CPU
si : Percentage of soft interrupt occupying CPU
st :
Fourth lines
Mem: 32879852k total, 23633040k used, 9246812k free, 311552k buffers
Physical memory usage
- total Total memory size
- used Already used
- free not used
- buffers Kernel buffer
Available memory = free + buffers + cached
Fifth lines
Swap: 4194300k total, 255104k used, 3939196k free, 10422508k cached
Virtual memory usage
Its remaining lines
free -m
View the usage and unused memory.
Mem total = used + free
Swap total = used + free
Available memory = free + buffers + cached
(-buffers/cache) usedMemory = Mem used, buffers – cached in the row
(+buffers/cache) freeMemory = Mem + free + buffers + cached in line
iostat
Format: iostat [options] [< time interval > [< times >]]
Examples:
iostat -d
iostat -d 2 2
iostat -x 1 2
netstat
Pay special attention to the number of “ESTABLISHEDs,” and if ESTABLISHEDs are more, the more connections are established, and if they remain high all the time, that’s because the system has a limit on the number of open connections.
Common application:
1、View the most connected IP
netstat -na | grep ESTABLISHED | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c
2、Statistics TCP connection number of different states
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
You can still do this.
du –max-depth=2 –block-size=M
perhaps
ll –block-size=M
Other related
《LinuxMaximum number of files opened by system “