centos view memory, cpu usage, top 10 occupancy, top X

Time:2024-1-15

I. Check the memory usage

(1) Method 1: Use the free command

This will display the system’s physical memory and swap space usage in a human-readable format.

free Unit K
free -m units of M
free -h unit G

centos view memory, cpu usage, top 10 occupancy, top X
Parameter description
total Total physical memory
used Used memory
free Unused memory
shared Multi-process shared memory
buff/cache Read and write cache memory
available Physical memory available to the application

(2) TOP instruction

The top command is used to monitor the system status of linux, such as cpu and memory usage.
Enter the top command
Press q to exit
By x, the highlighted sorting sequence should be %CPU by default, sorted by CPU usage.

centos view memory, cpu usage, top 10 occupancy, top X

Press shift+> ,to toggle highlighting, you can see the highlighted part to %MEM, sorted by memory usage.

centos view memory, cpu usage, top 10 occupancy, top X

You can also type top and press the “M” key to sort the processes by memory usage to see how much memory each process is using.

centos view memory, cpu usage, top 10 occupancy, top X

(3) View memory before X

Use the following command to view the first 10, and modify the number 10 to view the first X

ps aux | head -1;ps aux |grep -v PID |sort -rn -k +4 | head -10

centos view memory, cpu usage, top 10 occupancy, top X

Or, the number needs an extra +1

ps aux --sort -rss | head -n 11

centos view memory, cpu usage, top 10 occupancy, top X

Second, check the cpu occupancy

View Top 10

ps aux | head -1;ps aux |grep -v PID |sort -rn -k +3 | head -10

centos view memory, cpu usage, top 10 occupancy, top X

Or the following command, the number needs an extra +1

ps aux --sort -pcpu | head -n 11

centos view memory, cpu usage, top 10 occupancy, top X

Recommended Today

Resolved the Java. SQL. SQLNonTransientConnectionException: Could not create connection to the database server abnormal correctly solved

Resolved Java. SQL. SQLNonTransientConnectionException: Could not create connection to the database server abnormal correct solution, kiss measuring effective!!!!!! Article Catalog report an error problemSolutionscureexchanges report an error problem java.sql.SQLNonTransientConnectionException:Could not create connection to database server Solutions The error “java.sql.SQLNonTransientConnectionException:Could not create connection to database server” is usually caused by an inability to connect to the […]