If you are a Linux newbie, and have interest in system administration, or you want to become a power user, then you need to have a solid knowledge of the command line. There are several commands that you should know about, and one of them is uptime. This command returns set of values that involve, the current time, and the amount of time system is in running state, number of users currently logged into, and the load time for the past 1, 5 and 15 minutes respectively.
In this article, we will discuss the basics of this command using some easy to understand examples.
uptime uses a simple syntax:
# uptime [option]
|-h, –help||Display a brief help message, and exit.|
|-V, –version||Display version information, and exit.|
|-p, –pretty||Show uptime in pretty format.|
|-s, –since||System up since.|
How to use the uptime command
Uptime’s basic usage is very easy – just write the command’s name and press enter.
It will display an output similar to:
[email protected]:~$ uptime 07:54:50 up 24 days, 17:53, 1 user, load average: 1,74, 1,81, 1,99
In order of appearance, the command displays the
current time as the 1st entry,
up means that the system is running and it is displayed next to the total time for which the system has been running, the
user count (number of logged on users), and lastly, the
system load averages.
How to make the tool show up time in pretty format
In case you just want to know the time for which the system has been up, and that too in a more human-readable format, use the -p command line option.
~$ uptime -p
[email protected]:~$ uptime -p up 3 weeks, 3 days, 18 hours, 10 minutes
Check Linux Starting Time
You can also make uptime specifically display the time/date since when the system has been running. This can be done using the -s command line option.
~$ uptime -s
[email protected]:~$ uptime -s 2019-05-31 14:01:44
Uptime Version & Help
As it is with most command line apps, you can display uptime’s version information and quick help page with the following command.
~$ uptime -h Usage: uptime [options] Options: -p, --pretty show uptime in pretty format -h, --help display this help and exit -s, --since system up since -V, --version output version information and exit For more details see uptime(1).
You have successfully learned how to use uptime command in Linux. If you have any queries regarding this then please don’t forget to comment below.