Linux Commands

Linux Uptime Command

Any Linux distro comes with the “uptime” command. It’s an important command for system administrators to know. It helps troubleshoot the issues related to power and scheduling. Of course, there are other alternative tools available for this purpose but uptime is relatively simple and easy to use.

The content of this guide is as follows:

Let’s start the uptime command.

How Does the Uptime Command Work?

If you use the system’s uptime command via command prompt, you get many benefits out of it. For example, suppose you are facing a problem in connecting to the server. Then, you can easily run the uptime command on the server to check if there has been a recent reboot on the server. This helps in troubleshooting the situation and provides you with better visibility to apply the required solution.

$ uptime

The output specifies the current time. “Up” specifies that the system is up and running along with the total time that the system is up to the user count and the system load averages.

Running the uptime command of a Linux system via the command line, you get a specified  output in the following order:

  • The current time of the system.
  • The total uptime of the system.
  • The active users that are currently running the system.
  • The average of the system loads that is available for the past 1, 5, and 15 minutes.

Uptime command comes with various options. To check the options, we can run the “help” command.

$ uptime --help

Example 1: Uptime in Human-Readable Format

With the use of the “-p” option, you can get a pretty clear output which displays the uptime in the number of days, hours, minutes, and seconds format:

$ uptime -p

Example 2: Check the Start Time of the System

Another option is to check the exact time when the system is first started rather than the time spent since it started. Run the following command on the command-line interface with the “-s” option:

$ uptime -s

Example 3: Check the Version of the Installed Uptime Command

If you want to check the version of the installed uptime package in the system, run the following command with the “-V” option:

$ uptime -V

The output shows the current version of the “uptime” command.

Conclusion

Linux is a well-known environment and is highly recommended for various projects due to its stability and various configurations. The “uptime” command checks the system information. We explained the “uptime” command with its various options.

About the author

Syed Minhal Abbas

I hold a master's degree in computer science and work as an academic researcher. I am eager to read about new technologies and share them with the rest of the world.