How to Use the uptime Command to Check Server Status in Ubuntu

If you are managing a Linux server, one of the first questions you must answer during a troubleshooting session is, “Has this server rebooted recently?” If a web server suddenly went offline in the middle of the night, knowing exactly when it restarted can help you correlate the crash with automated backups or software updates.

You can find this information instantly using the uptime command. This simple tool tells you exactly how long the Ubuntu system has been continuously running since its last reboot, along with a quick snapshot of the current system load.

How to Use the uptime Command

The command requires no complex arguments or flags for basic usage.

  1. Open your Ubuntu terminal or connect to your server via SSH.
  2. Type the following command:
    uptime
  3. Press Enter.

The terminal will instantly output a single line of text that looks something like this:

 14:32:10 up 45 days,  3:14,  2 users,  load average: 0.45, 0.62, 0.70

Understanding the Output

While it is only one line long, that output contains five distinct pieces of vital system information. Reading from left to right:

  • 14:32:10 – The current system time on the server.
  • up 45 days, 3:14 – This is the actual “uptime”. In this example, the server has been running continuously without a reboot for exactly 45 days, 3 hours, and 14 minutes.
  • 2 users – The number of users currently logged into the system (this includes active SSH connections).
  • load average: 0.45, 0.62, 0.70 – This represents the system load (CPU and disk demand). The three numbers represent the average load over the last 1 minute, 5 minutes, and 15 minutes respectively. If the 1-minute load is significantly higher than the 15-minute load, a sudden spike in traffic or a runaway process has just occurred.

Alternative Formats

If you do not care about the load averages or how many users are logged in, and you only want to see how long the server has been running in a clean, human-readable format, you can use the “pretty” flag.

Run the following command:

uptime -p

The output will strip away the extra data and simply state:

up 6 weeks, 3 days, 3 hours, 14 minutes

Conversely, if you want to know the exact date and time the system was last powered on (rather than a cumulative count of days), use the “since” flag:

uptime -s

The output will display the exact boot timestamp, formatted like this: 2023-08-14 11:18:22.

Leave a Reply

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

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.