Exploring Three Simple Linux Commands: w, who, and uptime
Linux offers a plethora of commands to help users monitor system activity and performance. In this article, we'll explore three simple yet powerful commands: w, who, and uptime. These commands provide valuable insights into user activity and system load.1. The w Command
The w command displays information about the users currently logged into the system and their activities. It also provides a summary of system uptime and load averages.Example:
Code:
w
Output:
15:22:23 up 2:34, 4 users, load average: 0.15, 0.10, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
alice pts/0 192.168.1.2 13:00 1:22m 0.10s 0.10s -bash
bob pts/1 192.168.1.3 13:05 1:20m 0.20s 0.20s -bash
carol pts/2 192.168.1.4 13:10 1:18m 0.30s 0.30s -bash
dave pts/3 192.168.1.5 13:15 1:16m 0.40s 0.40s -bash
2. The who Command
The who command shows who is currently logged into the system. It provides details such as the username, terminal, and login time.Example:
Code:
who
Output:
alice pts/0 2025-01-02 13:00 (192.168.1.2)
bob pts/1 2025-01-02 13:05 (192.168.1.3)
carol pts/2 2025-01-02 13:10 (192.168.1.4)
dave pts/3 2025-01-02 13:15 (192.168.1.5)
3. The uptime Command
The uptime command provides a quick summary of how long the system has been running, the number of users currently logged in, and the system load averages.Example:
Code:
uptime
Output:
Code:
15:22:23 up 2:34, 4 users, load average: 0.15, 0.10, 0.05
Understanding Load Averages
The load average numbers represent the average system load over the last 1, 5, and 15 minutes. These numbers indicate how many processes are waiting to be executed by the CPU.- 1-minute load average: The average load over the last minute.
- 5-minute load average: The average load over the last five minutes.
- 15-minute load average: The average load over the last fifteen minutes.