Beginners Guide for Uptime Command in Linux

Linux TLDR
Last Updated:
Reading time: 2 minutes

The uptime command is one of the many resourceful Linux utilities for sysadmins that is capable of telling the system boot related information like the current time, the uptime (in days and hours), the number of users currently logged on to the system, and the load average.

The introduction went too far, but the utility is pretty simple for beginners to understand, so let’s start with practical examples.

Tutorial Details

DescriptionCheck how long the system has been running.
Difficulty LevelLow
Root or Sudo PrivilegesNo
OS CompatibilityUbuntu, Manjaro, Fedora, etc.
Prerequisitesuptime
Internet RequiredNo

Usage of the Uptime Command

The uptime command takes only one argument as an option (optional).

$ uptime [OPTION]

Now, if you run this command without any options, you will get something like this as a result.

😮
The first line of the w command is the same as the uptime output.
uptime command output

The above output includes the following fields:

  • System time: The current time of the system.
  • Up time: How long the system has been running (2 hours and 36 minutes).
  • Number of users: The count of all the logged-in users.
  • Average system load: The average CPU load for the past 1, 5, and 15 minutes.

The following is an example of this command when executed without any options:

$ uptime

Output:

Usage of uptime command

The uptime pulls the boot related information from the “/proc” files, and user-related information is fetched from the “/var/run/utmp” file.

Also Read:

Uptime Command Syntax

The uptime command supports a few options that directly reflect the output when they are applied, so let’s see each of these options, starting with

Show Output in Pretty Format

If you think the uptime output is too cluttered with unnecessary stuff, then you can use the “-p” flag to get clean output.

$ uptime -p

The above command will only show you the uptime information (how long your system has been running) in words.

Uptime output in a pretty format

As you can see from the above picture, the target machine was booted 13 minutes ago.

Show the Date and Time When the System Booted Up

The “-s” flag will only return the date and time when the system booted up.

$ uptime -s

Output:

Show the date and time when the target system booted up

From the above picture, it appears that the target machine has booted at “2023-01-11” at “10:11:07“, which is quite mysterious since I did not restart or do anything at that time.

Let me check the historical record of uptime for the target machine using the uprecords command; until then, you can check our other articles.

Also, don’t forget to tell me when your system last booted or restarted in the comments section.

Till then, peace!

Join The Conversation

Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.