How do you find the uptime of a Linux server?

last updated in Categories , , , ,

I am a new Linux system user. I need to find the uptime of a Linux server located in AWS cloud. How do I check Linux system uptime?

Linux command ship with various command line tools to find out server uptime command. File /proc/uptime has uptime information, and file /var/run/utmp has information about who is currently logged on. However, data from /proc/uptime or /var/run/utmp file is not directly readable by humans, so you need to use the following commands.

ADVERTISEMENTS


Command to find the uptime of a Linux server

To find the uptime of a Linux server use any one of the following command. First, open the terminal window and then type:

  1. uptime command – Tell how long the Linux system has been running
  2. w command – Show who is logged on and what they are doing including the uptime of a Linux box
  3. top command – Display Linux server processes and display system Uptime in Linux too.

Let us see examples.

How to check system uptime in Linux

Open the terminal application on Linux and type the following uptime command:
uptime

Commands to find the uptime of a Linux server
My Linux system is running from last 13 days

The uptime command gives a one line display of the following information.

  • The current time – 10:46:56
  • How long the system has been running – up 13 days
  • How many users are currently logged on – 1 user
  • The system load averages for the past 1, 5, and 15 minutes (0.15, 0.08, 0.08)

Show uptime in pretty and human readable format by passing the -p as follows:
uptime -p
Sample outputs:

up 1 week, 6 days, 2 hours, 50 minutes

Want to find out the system is up since what time?

Try passing the -s as follows to see information in yyyy-mm-dd HH:MM:SS format:
uptime -s
Sample outputs:

2019-05-16 08:13:44

Check Linux system uptime with w command

Run the w command to show information about the users currently on the Linux machine, and their processes. The header shows, in this order, 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. For example, type the following w command:
w
How to Check System Uptime in Linux

Display server uptime in Linux using top command

The top command provides a dynamic real-time view of a running system. It can display system summary information as well as a list of processes including system uptime. Open the terminal and run:
top
Linux server uptime command

Conclusion

You learned how to use the uptime command that display the current time, the length of time the Linux system has been up, the number of users online, and the load average. For more information, see this page and the following pages too:

  • Linux Server see the historical and statistical uptime of system with tuptime utility
  • man uptime

ADVERTISEMENTS

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Start the discussion at www.nixcraft.com

Historical Comment Archive

1 comment

    Still, have a question? Get help on our forum!