The Wayback Machine - https://web.archive.org/web/20240204104410/https://www.geeksforgeeks.org/linux-uptime-command-with-examples/
Open In App
Related Articles

Linux | Uptime command with examples

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

Uptime Command In Linux: It is used to find out how long the system is active (running). 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.

Syntax:

uptime [-options]

Example:
Input

[mistersubha@server-1 ~]$uptime              
 08:24:37 up 207 days, 11:10,  0 users,  load average: 0.00, 0.03, 0.05               

Output
uptime

From the above code, the output has got four parts: Current time, Uptime, Number of Users, and average load as mentioned earlier.

uptime has got few options to tailor outputs and to those who are unaware of the options of the newbies working with uptime can use the option “-h” (which means help). This will give the options available to the preceding command.

[mistersubha@server-1 ~]$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).

uptime -h
Just to make sure you get the uptime in human-readable format, you can use option “p”

[mistersubha@server-1 ~]$uptime -p
up 29 weeks, 4 days, 11 hours, 1 minute

Uptime -p
Option “s” is used to get the starting time/specified time when the system started has been running.

[mistersubha@server-1 ~]$uptime -s
2017-11-10 20:14:15

uptime -s
Version information can be shown using option “V”.

[mistersubha@server-1 ~]$uptime -V
uptime from procps-ng 3.3.10

uptime -V
There are few other ways to find the uptime and output header of command “w” is similar to that of output of “uptime” command.

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Looking for a place to share your ideas, learn, and connect? Our Community portal is just the spot! Come join us and see what all the buzz is about!


Last Updated : 27 May, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads