Linux uptime Command Explained for Beginners with Examples
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. In this article, we will discuss the basics of this command using some easy to understand examples.eval(ez_write_tag([[728,90],’howtoforge_com-box-3′,’ezslot_5′,106,’0′,’0′]));
But before that, it’s worth mentioning that all examples used in this tutorial have been tested on an Ubuntu 18.04 LTS machine.eval(ez_write_tag([[580,400],’howtoforge_com-medrectangle-3′,’ezslot_2′,121,’0′,’0′]));
Linux uptime command
As the name suggests, the uptime command gives you the time for which the system has been up (or running). Here’s its syntax:
And here’s is the way the tool’s man page explains it:
uptime gives a one line display of the following information. The current time, how long the system
has been running, how many users are currently logged on, and the system load averages for the past
1, 5, and 15 minutes.
The following Q&A-styled examples should give you a better idea on how the uptime command works.
Q1. How to use the uptime command
Uptime’s basic usage is very easy – just write the command’s name and press enter.
Here’s the kind of output the tool produces:
So the first entry is the current time, then ‘up’ shows the system is running, 5:53 is the total time for which the system has been up, and then finally are the system load averages. Just in case you want to know more, here’s what the uptime man page says about the last entry:
System load averages is the average number of processes that are either in a runnable or
uninterruptable state. A process in a runnable state is either using the CPU or waiting to use the
CPU. A process in uninterruptable state is waiting for some I/O access, eg waiting for disk.
The averages are taken over the three time intervals. Load averages are not normalized for the
number of CPUs in a system, so a load average of 1 means a single CPU system is loaded all the
time while on a 4 CPU system it means it was idle 75% of the time.
Q2. 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.eval(ez_write_tag([[580,400],’howtoforge_com-medrectangle-4′,’ezslot_1′,108,’0′,’0′]));
Here’s the output this command produced in our case:
Q3. How to make uptime display date/time since when the system is up
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.
Here’s the output the command produced in our case:
Q4. How to get version information and help in general
Use the -V option to get version information, and -h for general help.
As you’d have observed, the uptime command is easy to understand and use. It doesn’t offer many features (or command line options). What all it offers have been discussed here. So just practice these options and you should be ready to use uptime in your day-to-day work. Just in case you require, here’s the tool’s man page.