How to use the w and uptime commands to view Linux system usage

  
                

In the previous tutorial, we mentioned that using the top, vmstat and other commands can check the CPU usage of the Linux system, that is, the system load. (See how the system uses Linux commands to view CPU usage.) In addition to these commands, you can use the w command and the uptime command to view the Linux system load. Let's take a look at it.

1. w command

[root @ linuxidc ~] # w

14:44:27 up 62 days, 3 min, 2 users, load average : 0.00, 0.01, 0.00

USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT

root pts/0 218.18.74.196 13:38 1:01m 0.00s 0.00s -bash

root pts/1 218.18.74.196 14:43 0.00s 0.00s 0.00sw

Unlike Who, the introduction of this command by Linux using man w is "Show who is logged on and What they are doing.”,w command can query the user information of the current system, and what operations these users are currently doing, this information is of value to Linux system administrators, and the three behind the load average The figures show the average system load for the last 1 minute, 5 minutes, and 15 minutes of the system.

2. uptime command

[root@linuxidc ~]# uptime

14:51:15 up 62 days, 10 min, 2 users, load average: 0.02, 0.01, 0.00

The meaning of the load average in the uptime command echo is similar to the w command, which is the average number of processes in the process queue in the past 1 minute, 5 minutes, and 15 minutes.

Here you need to pay attention to the load average output value, the size of these three values ​​can not be greater than the number of system logic CPU, for example, the output system has 4 logical CPU, if load average three When the value is longer than 4, the CPU is very busy and the load is high, which may affect the system performance. However, when it is greater than 4, you don't have to worry about it. Generally, it will not affect the system performance. Conversely, if the output value of load average is less than the number of CPUs, it means that the CPU is still idle. For example, the output in this example, the CPU is relatively idle.

The above is the way Linux uses the w command and the uptime command to view the system load (usage rate). The w command is not used much, so many people don't understand its usage. Introduction You can have some understanding of this command.

Copyright © Windows knowledge All Rights Reserved