Chat Zalo Chat Messenger Phone Number Đăng nhập
How to Check Server Uptime in Linux | Linux Tutorials for Beginners

How to Check Server Uptime in Linux | Linux Tutorials for Beginners

Server Uptime

Server uptime is an important metric that indicates how long a system has been running without interruption. On Linux, there are several commands you can use to check server uptime, including uptime, w, and top.

In this guide, we’ll cover these commands, along with some other methods for determining server uptime.

Method 1:


uptime command The uptime command is the simplest way to check server uptime on Linux. Displays the current time, system uptime, number of users, and average load. To use the uptime command, simply run

: uptime The

output will display uptime in days, hours, and minutes, along with other system information

. 22:54:34 up 1:26, 1 user, average load: 0.11, 0.03, 0.01

That is


  • The current time (22:54:34
  • ) How

  • long the system has been running (1 hour and 26
  • minutes)

  • How many users are currently logged on
  • (1 user)

  • System load averages for the last 1, 5, and 15 minutes (0.11, 0.03, 0.01)

Method 2: The w

command provides information about current system users and what they are doing, along with server uptime. To use

the w command, run: w

The first line of the output displays the current time, system uptime, number of users, and average load, similar to the uptime command

. 23:06:57 up 1:38, 1 user, average load: 0.00, 0.00, 0.00 TTY USER FROM LOGIN@ IDLE JCPU PCPU WHAT root pts/0 21:30 0.00s 1.85s 0.01s w

Method 3: The top


Top command is a real-time system monitoring tool that provides an overview of system processes and resource usage. It also shows server uptime. To use

the top command, run: top

Server uptime is displayed at the top of the output, next to the current time and system load averages

. 23:27:01 up 4 days, 10:20, 1 user, average load: 0.22, 0.12, 0.09 Tasks: 163 total, 1 running, 162 sleeping, 0 stopped, 0 zombie %CPU(s): 6.1 us, 1.0 sy, 0.0 ni, 92.7 id, 0.1 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 4043436 total, 282644 free, 1044916 used, 2715876 buff/cache KiB Swap: 8388600 total, 8316440 free, 72160 used. 2905352 take advantage of Mem

To exit the top command, press q

. Method 4: The /proc/uptime Linux file stores server uptime in seconds in the /

proc/uptime file

. You can check the contents of this file to determine server uptime. To do this, run

: cat /proc/uptime

The output displays two values: system uptime in seconds and idle time in seconds. You can use awk to convert the uptime value to a more human-readable format: awk

‘{print int($1/86400)” days “int(($1%86400)/3600)” hours “int(($1%3600)/60)” minutes”}’ /proc/uptime

This command will display server uptime in days, hours, and minutes.

Method 5: The sysinfo command (not available on all systems)

On some Linux distributions, you can use the sysinfo command to display miscellaneous system information, including server uptime. To use the

sysinfo command, run: sysinfo Server

uptime is displayed in the output along with other

system information. Method 6: The who command with the -b option

The who command

can display miscellaneous information about system users, but it also has a -b option that displays the last boot time of the system. To use the who command with the -b option, run: who -b

The output shows the last system boot time. You can calculate server uptime by subtracting boot time from the current time.

Method 7: The Last Command with the -x Option The

last command displays the logon history of users on the system. By using the -x option, you can also view information about system shutdowns and reboots. To use the last command with the -x option, run: last -x

Look for the most recent “system boot” entry in the output. This indicates the last time the system was restarted, from which you can calculate server uptime.

Method 8: Using


For systems that use systemd, you can use the systemd-analyze command to check server uptime. To do this, run:


The output shows the time elapsed since the last system boot. Note that this command may not be available on all Linux distributions.

Commands mentioned

: Uptime: Displays system uptime, current time, number of users, and average load. w – Provides information about current users and their activity, along with system uptime and average load. top – Monitors system processes and resource usage in real time, and displays server uptime. cat /proc/uptime: Displays server uptime

  • in seconds from the /proc/
  • uptime file.

  • sysinfo: Displays miscellaneous system information, including server uptime (not available on all systems).
  • who -b – Displays the last

  • boot time of the system.
  • last -x: Displays user logon history, System shutdowns and reboots.
  • systemd-analyze – Checks server uptime on systems using ‘systemd’ (may not be available on all Linux distributions).


In this guide, we’ve covered several methods for checking server uptime on Linux, including the uptime, w, top, /proc/uptime, sysinfo, who, last, and systemd-analyze commands. By using these tools, you can easily monitor your server’s uptime and make sure it runs smoothly and reliably.

Please feel free to leave comments and suggest improvements to this guide. Your feedback is valuable and helps us improve our content for our audience.

Contact US