Blog

03/06/2019

How do you find the uptime of a Linux server?



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.

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

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

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

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

(adsbygoogle = window.adsbygoogle || []).push({});

Posted by: SXI ADMIN

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.

20/08/2019

Start your Bitcoin Exchange with our Software

Start your Bitcoin Exchange with our Software Setup your white label bitcoin exchange right away. Or create your own cryptocurrency using...
14/08/2019

How to KVM, QEMU start or stop virtual machine from command line (CLI)

KVM or Kernel Based Virtual Machine is a popular virtualization technology. It allows you to run virtual guest machines over a host machine. To start...
14/08/2019

How to Docker backup Saving and restoring your volumes

Running a Docker volume backup First, we spin up a temporary container, and we mount the backup folder and the target Docker volume to this container....