How to Check the Uptime of Your Ubuntu Server

The Server Stability Vector

When maintaining a headless Ubuntu Linux server in a production environment, understanding the exact timeline of the machine’s operation is critical. If a web application suddenly goes offline during the night, an administrator must quickly determine whether the software itself failed, or if the entire operating system was subjected to an unexpected power loss or automated reboot. Relying on complex system logs to find a simple reboot timestamp is highly inefficient.

How to Check Server Uptime

The standard tool for querying the continuous operational duration of a Linux machine is the aptly named uptime command.

1. Open your terminal application or connect to your server via an SSH session.
2. To view the raw, concise duration of the server’s current session, execute the following command:

uptime -p

3. The terminal will immediately output a clean, human-readable string, such as up 3 weeks, 4 days, 2 hours, 14 minutes.

4. If you need to pinpoint the exact time and date the server last booted up, execute the command with the -s (since) flag:

uptime -s

5. The terminal will output the precise, timestamped moment of the last boot sequence (e.g., 2023-11-14 08:32:00).

By utilising these simple flags, administrators can instantly determine whether a server has suffered an unexpected restart without trawling through system daemon logs.

Get the best tech tips delivered straight to your inbox.

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