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.
|Check how long the system has been running.
|Root or Sudo Privileges
|Ubuntu, Manjaro, Fedora, etc.
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 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 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.
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
-s” flag will only return the date and time when the system booted up.
$ uptime -s
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!