In this article, you will explore how to check system uptime in Linux Command Line. System uptime refers to the amount of time a Linux system has been running without a reboot. Monitoring uptime is important for troubleshooting, performance auditing, and understanding system stability. Linux provides several built-in commands that allow you to quickly check uptime from the terminal.
The most commonly used commands, how they work, and practical examples for system administrators are illustrated here.
Table of Contents
What Is System Uptime?
System uptime shows how long your Linux machine has been running uninterruptedly since its last reboot. It helps you:
- Monitor server stability
- Detect unexpected restarts
- Track maintenance or downtime
- Analyse long-running processes
Linux offers multiple methods for checking uptime using built-in tools.
Method 1: Using the uptime Command (Recommended)
- Basic Uptime Information
Run the following command:uptime
This will display:
- Current system time
- Total uptime
- Number of logged-in users
- Load averages for the last 1, 5, and 15 minutes
- Human-Readable Uptime
For a cleaner, sentence-style output, use:uptime -p
Example output:
up 2 days, 4 hours, 15 minutes - Show the Exact Last Reboot Time
To find when the system was last restarted:uptime -s
Example:
2025-01-10 14:22:45
Method 2: Using the who Command
Run:
who -b
This shows the last system boot time, for example:
system boot 2025-01-15 10:05
This method is helpful when you only need to know when the system last restarted.
Method 3: Reading /proc/uptime
Linux stores uptime data in the virtual /proc filesystem.
Run:
cat /proc/uptime
You will see two numbers:
Example:
150203.55 148500.30
This method is often used by scripts, monitoring agents, or custom tools.
Method 4: Using top or htop
- Check Uptime with top
Run:top
Uptime appears at the top of the interface along with:
- Current time
- Logged-in users
- Load averages
- Check Uptime with htop
If installed, use:htop
htop provides a colour-coded, user-friendly display with uptime visible in the top bar.
Method 5: Using the last Command
Run:
last reboot
This displays the reboot history, including:
Ideal for auditing, troubleshooting, and detecting unexpected system reboots.
Conclusion
In this manner, checking system uptime in Linux is straightforward, and you can use several built-in commands depending on your needs. The uptime command gives quick overall information, ‘who’ helps identify the last reboot time, and /proc/uptime is ideal for scripts or automated monitoring. Each method offers valuable insights into system performance and stability. Regularly checking uptime helps administrators keep servers healthy and reliable.
A Linux VPS Hosting solution provides the stability, flexibility and control needed for business applications.
Want to adjust your server settings too? Learn How to change the server time zone in WHM