How does Linux view system/server running time

In daily work and study, we occasionally need to know how long our Linux system has been running normally without downtime, or when the system was started. The running time of the server may not be important for some users, but it is crucial if the server is running in key applications such as online shopping mall

Method One: uptime command

It tells you how long the system has been running and shows you in one line the current time, system run time, number of current logged-on users, average system load for the last 1/5 minutes/15 minutes.


08:34:29 up 21 days, 5:46, 1 user, load average: 0.06, 0.04, 0.00

Method 2: w Command

For each user logged into the system, what each user is currently doing, the impact of all active loads on the computer provides a quick overview. This single command combines the results of several Unix programs: who, uptime, and ps-a.


08:35:14 up 21 days, 5:47, 1 user, load average: 0.26, 0.09, 0.02


Root pts/1 08:34 0.00s 0.01s 0.00s w

Method 3: top command

It is one of the basic commands for monitoring real-time system processes on Linux. It displays system information and process information such as uptime, average load, tasks running, number of logged-on users, number of CPUs & CPU utilization, memory & swap space information.


Top – 08:36:01 up 21 days, 5:48, 1 user, load average: 0.12, 0.08, 0.02

Tasks: 98 total, 1 running, 97 sleeping, 0 stopped, 0 zombie

Cpu(s): 0.0%us, 0.3%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

Mem: 1872888k total, 1454644k used, 418244k free, 175804k buffers

Swap: 2097148k total, 0k used, 2097148k free, 1098140k cached


1 root 20 0 19340 1492 1172 S 0.0 0.1 0:01.04/sbin/init

2 root 200 0 0 0 0 S 0.0 0 0:00.00 [kthreadd]

3 root RT 0 0 0 0 0 S 0.0 0 0:00.00 [migration/0]

4 root 20 0 0 0 0 0 S 0.0 0 0:34.32 [ksoftirqd/0]

5 root RT 0 0 0 0 S 0.0 0 0:00.00 [stopper/0]

Method 4: WHO Command

List the users currently logged on to the computer. The who command is similar to the w command, but the latter also contains additional data and statistics.


System boot 2018-04-12 02:48

Method 5: Last command

List recently logged-in users. LastBacktrace/var/log/wtmp file and display the user logged in (out) since the file was created.

last reboot-F | head-1 | awk'{print $5, $6, $7, $8, $9}’

Thu Apr 12 02:48:04 2018

Method 6: /proc/uptime file

This file contains details of the run time since the last system boot. / The output of proc/uptime is fairly compact. The first number is the total number of seconds since the system was started. The second number is the amount of time spent idling the system in seconds over the total time.


1835457.68 1809207.16

Leave a Reply

Your email address will not be published.