When was the last time you shut down or restarted your Linux system? Can't remember? Maintaining an optimal uptime is essential for the smooth running of your system and preventing downtime.

It is also essential to know your system uptime when troubleshooting. You do not need to be a tech guru to be able to check your system's uptime when you need to. Let's see how you can easily check the uptime for your Linux system.

What Is System Uptime?

System uptime refers to the amount of time a computer has been running since its last restart or shutdown. It is a measure of the stability and reliability of a system and can be used to determine how long a system has been available for use.

On Linux, the uptime is calculated from the moment the operating system starts until the moment it is shut down or restarted. You can view the uptime information using various commands, including uptime, which provides a quick summary of the system uptime, the load averages, and the number of currently running tasks.

Here are some of the ways you can check your system uptime on Linux:

Find the System Uptime Using uptime

uptime is the default command you can use to check for how long your system has been running. It also provides information on the number of users, the present time, and the load average.

The uptime command syntax looks like this:

        uptime [options]
    

To check the system uptime, execute the following:

        uptime
    

It should give a result like this:

        09:24:43 up  1:53,  1 user,  load average: 0.16, 0.07, 0.03
    

If you want the output in a more readable format, run:

        uptime -p
    

This would print the result in a prettier format:

        up 1 hour, 55 minutes
    

To see the last time you rebooted your system, execute:

        uptime -s
    

The output would be similar to the following:

        2023-02-10 07:31:00
    

To get command-line help regarding the uptime command, use:

        man uptime
    

Check the System Uptime on Linux Using who

The who command shows the users currently logged into your system. But you can also use it to know when you last restarted your system.

Execute the following command to find out:

        who -b
    

Find Your System's Uptime Using the top Command

The top command is a real-time system monitoring tool for Linux. It provides a dynamic view of the system's performance and resource usage.

top displays information about the processes running on a system, including their process ID, command name, uptime, priority, CPU usage, memory usage, and other performance metrics.

Simply type top into your terminal and hit Enter:

        top
    

On the first line of the result, you see the uptime in this format: up hh:mm.

the top command output for system uptime

Check the System Uptime Using /proc/uptime

Another way of finding the uptime in Linux is by reading the /proc/uptime file. This file is a part of procfs and contains information about the system uptime. Use the cat command to view the contents of the file:

        cat /proc/uptime
    

It will display the uptime in seconds.

Knowing Your System Uptime on Linux Is Important

Knowing the system uptime can be helpful in several ways. For example, system administrators can use it to monitor the stability and reliability of their systems and to identify any problems that may arise. You can use it to determine how long a system has been available for use and to plan your work accordingly.

Overall, system uptime is a simple but important metric for monitoring and managing the performance and stability of a Linux system.