Easy Ways to Find Linux System/Server Uptime

Do you want to know, how long your Linux system has been running without downtime? when the system is up and what date.

There are multiple commands is available in Linux to check server/system uptime and most of users prefer the standard and very famous command called uptime to get this details.

Server uptime is not important for some people but it’s very important for server administrators when the server running with mission-critical applications such as online shopping portal, net-banking portal, etc,.

It should be zero downtime because if there is any down time then it will impact badly to millions of users.

If you want to collect Linux system uptime reports once a month, see the following bash script.

As we told many commands are available to check server uptime in Linux. In this tutorial we are going teach you how to check this using below 11 methods.

Uptime means how long the server has been up since its last shutdown or reboot.

The uptime command fetch the details from /proc files and print the server uptime, the /proc file is not directly readable by humans.

The below commands will print how long the system has been running and up. It also shows some additional information.

Method-1: How to Check Linux System Uptime Using the uptime Command

uptime command will tell how long the system has been running. It gives a one line display of the following information.

The current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes.

# uptime

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

Method-2: How to Check Linux System Uptime Using the w Command

The “w” command provides a quick summary of every user logged into a computer, what each user is currently doing.

The header shows, the current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes.

# w

 08:35:14 up 21 days,  5:47,  1 user,  load average: 0.26, 0.09, 0.02
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/1    103.5.134.167    08:34    0.00s  0.01s  0.00s w

Method-3: How to Check Linux System Uptime Using the who Command

The “who” command will show a list of users who are currently logged into the system. The “who” command is related to the command “w”, which provides the system boot time.

# who -b

system boot  2020-01-11 02:48

Method-4: How to Check Linux System Uptime Using the last Command

The last command displays a list of last logged in users. Last searches back through the file “/var/log/wtmp” and displays a list of all users logged in (and out) since that file was created.

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

Thu Jan 11 02:48:04 2020

Method-5 : Using procinfo Command

The Procinfo command collects some system data from the “/ proc” directory and prints it well on a standard output device.

# procinfo | grep Bootup

Bootup: Sat Jan 11 19:40:14 2020   Load average: 0.16 0.05 0.06 1/138 16615

Method-6: How to Check Linux System Uptime Using the top Command

Top command is one of the best and basic command to monitor real-time system processes in Linux. It display system information and running processes information like uptime, average load, tasks running, number of users logged in, number of CPUs and cpu utilization, Memory and swap information.

# top -c

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

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
    1 root      20   0 19340 1492 1172 S  0.0  0.1   0:01.04 /sbin/init
    2 root      20   0     0    0    0 S  0.0  0.0   0:00.00 [kthreadd]
    3 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 [migration/0]
    4 root      20   0     0    0    0 S  0.0  0.0   0:34.32 [ksoftirqd/0]
    5 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 [stopper/0]

Method-7: How to Check Linux System Uptime Using the ps Command

systemd is a new init system and system manager, that was adopted by most of Linux distributions now over the traditional SysVinit manager. You can easily find the system boot time by grep the systemd process with the ps command.

# ps -eo pid,comm,lstart,etimes,time,args | grep -i "systemd" | head -1
    1 systemd         Sat Jan  11 11:17:33 2020 1114684 00:03:45 /usr/lib/systemd/systemd --switched-root --system --deserialize 22

Method-8: How to Check Linux System Uptime Using the tuptime Command

Tuptime command is a tool for reporting the system’s historical and statistical running time, keeping it between restarts. This is similar to the uptime command, but shows a very interesting output.

# tuptime

System startups:        1   since   02:48:00 AM 01/11/2020
System shutdowns:       0 ok   -   0 bad
System uptime:          100.0 %   -   26 days, 5 hours, 31 minutes and 52 seconds
System downtime:        0.0 %   -   0 seconds
System life:            26 days, 5 hours, 31 minutes and 52 seconds

Largest uptime:         26 days, 5 hours, 31 minutes and 52 seconds   from   02:48:00 AM 01/11/2020
Shortest uptime:        26 days, 5 hours, 31 minutes and 52 seconds   from   02:48:00 AM 01/11/2020
Average uptime:         26 days, 5 hours, 31 minutes and 52 seconds

Largest downtime:       0 seconds
Shortest downtime:      0 seconds
Average downtime:       0 seconds

Current uptime:         26 days, 5 hours, 31 minutes and 52 seconds   since   02:48:00 AM 01/11/2020

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

Leave a Reply

Your email address will not be published. Required fields are marked *