5 Ways to Check Uptime in Linux

In this comprehensive guide, we’ll show you five ways to check the uptime of your Linux system from the command line. Whether you’re a beginner or an experienced user, you’ll learn how to use powerful tools like uptime, w, last, cat, and date to track the health and stability of your system. Don’t let downtime catch you off guard. Follow these steps and stay in control of your Linux uptime.

How To Check Uptime On Linux?

There are several commands that can be used to check the uptime of a Linux system from the command line. Here are some examples:

  • uptime: This command displays the current time, the length of time the system has been running, the number of users currently logged on, and the system load averages for the past 1, 5, and 15 minutes. For example:

uptime 22:34:01 up 3 days, 23:06, 3 users, load average: 0.00, 0.01, 0.05

  • w: This command displays information about the users currently logged on to the system, including their login time and the command they are running. The uptime of the system is displayed in the first line. For example:

w 22:34:01 up 3 days, 23:06,  3 users, load average: 0.00, 0.01, 0.05 USER TTY  FROMLOGIN@ IDLE JCPU PCPU WHAT user1 tty1  22:34  4:44  0.00s  0.00s -bash user2 tty2  10.0.0.122:34  4:44  0.00s  0.00s -bash user3 pts/0  10.0.0.2  22:34  4:44  0.00s  0.00s -bash

  • last: This command displays a list of all users who have logged on to the system, along with their login and logout times. The uptime of the system is displayed in the first line. For example:

last 22:34:01 up 3 days, 23:06,  3 users, load average: 0.00, 0.01, 0.05 user1 tty1 Mon Dec 21 22:34 - 22:34 (00:00) user2 tty2  10.0.0.1 Mon Dec 21 22:34 - 22:34 (00:00) user3 pts/0  10.0.0.2 Mon Dec 21 22:34 - 22:34 (00:00) reboot  system boot  4.4.0-168-ge Mon Dec21 22:33 - 22:34 (00:00)

  • cat /proc/uptime: This command displays the uptime of the system in seconds, along with the amount of time the system has spent in idle. For example:

cat /proc/uptime 275437.70 178469.37

  • date: This command displays the current date and time. If the uptime of the system is needed, it can be combined with the awk command to extract the uptime from the output of the uptime command. For example:

uptime | awk '{print $3,$4}' 3 days,

  • top: This command displays information about the running processes on a system. It also displays the current uptime of the system at the very top. This command is very similar to htop.

top

linux_top_command

 

Summary
5 Ways to Check Uptime in Linux
Article Name
5 Ways to Check Uptime in Linux
Description
Are you a Linux user looking for ways to check your system uptime? In this comprehensive guide, we'll show you 5 different commands and techniques for monitoring uptime in Linux.
Author

Leave a Comment