Author: waste big brother source: www.cnblogs.com/cjsblog/p/9562380.html

1, the top

It’s equivalent to Windows Task Manager

As you can see, the output is divided into two parts. The first five lines are the overview, and the following are the specific process resource usage. So let’s go through it line by line

Line 1

Top-18:14:58 up 112 days, 1:35, 1 user, load average: 0.00, 0.10, 0.11

Represents in turn: the current time, the time the system has been running, the number of users currently logging in, and the load of the system in the past 1 minute, 5 minutes and 15 minutes

PS: From this line we can learn the following information:

  • The current time is 18:14:58
  • The system ran for 112 days, 1 hour and 35 minutes
  • 1 user is currently logged in
  • In the past 1 minute, 5 minute, 15 minute load is 0.00, 0.10, 0.11 respectively

A load of more than 1 indicates overload

Line 2

Tasks: 225 total, 1 running, 224 sleeping, 0 stopped, 0 zombie

Process information

  • Total number of processes
  • The number of processes running
  • Number of processes in the Sleeping
  • Number of processes stopped
  • Zombie processes

(PS: From this line we can see that there are currently 225 processes in total)

Line 3

Cpu (s) : 1.8% of the us, 0.9% sy, 0.0% ni, 97.1% id, wa, 0.1%, 0.0% hi si, 0.1% 0.0% of st

CPU usage

Us: Percentage of CPU used by user processes

Sy: Percentage of CPU used by kernel processes

Ni: Percentage of CPU used by processes that have changed their priority

Id: Percentage of idle CPU

Wa: Percentage of CPU used by IO waiting processes

Hi: Percentage of CPU consumed by hard interrupts

SI: Percentage of CPU used by soft interrupts

St:

Line 4

Mem: 32879852k total, 23633040k used, 9246812k free, 311552k buffers

Physical memory usage

  • Total total memory size
  • 2 have been used
  • Free is not used
  • BUFFERS kernel buffers

Free memory = free + buffers + cached

Line 5

Swap: 4194300k total, 255104k used, 3939196k free, 10422508k cached

Virtual memory usage

The rest of the line

2, free – m

Look at used and unused memory

MemTotal = used + free

SwapTotal = used + free

Free memory = free + buffers + cached

(-buffers/cache) used number of memory = used — buffers — cached in line Mem

(+buffers/cache) free memory = free +buffers + cached on line Mem

3, iostat

Format: iostat [options] [< interval > [< number >]]

Example:

iostat -d

iostat -d 2 2

iostat -x 1 2

4, netstat

Pay particular attention to the number of “ESTABLISHED” connections, as more ESTABLISHED means more connections are ESTABLISHED, and if this stays high, it’s a concern because the system has a limit on the number of open connections.

Common applications:

1, View the IP with the most connections

netstat -na | grep ESTABLISHED | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c

2. Count the number of TCP connections in different states

netstat -na | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}' 

5, df -h

View file system disk space usage

6, du – sh

View (calculate) the file size

Or you could do this

du –max-depth=2 –block-size=M

or

ll –block-size=M

Recent hot article recommended:

1.1,000+ Java interview questions and answers (latest version of 2021)

2. I finally got the IntelliJ IDEA activation code through open source project. How nice!

3. Ali Mock tool officially open source, kill all the Mock tools in the market!

4.Spring Cloud 2020.0.0 is officially released, a new and disruptive version!

5. “Java development manual (Songshan edition)” the latest release, fast download!

Feel good, don’t forget with thumb up + forward oh!