The uptime command is used to show how long the system has been running. It will also show currently logged in users, system load average and the current time. In this tutorial, we have described the use of uptime in detail.
Uptime Command Syntax
The syntax for the uptime command is as follows:
Where, you can pass arguments to view in different format using
How to use the uptime command
To just display the uptime without any option run below command:
It will print output as following:
04:26:09 up 15 day, 1:21, 1 user, load average: 0.16, 0.03, 0.01
- 04:26:09 is the current system time.
- up 15 days, 1:21 is the length of time the system has been up.
- 1 user is the number of logged in users.
- load average: 0.16, 0.03, 0.01 are system load averages for the past 1, 5, and 15 minutes.
System load averages is the average number of processes that are currently running or waiting for disk I/O. A process in a runnable state is either using the CPU or waiting to use the CPU.
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.
Uptime Command Options
Following are the options for uptime commands:
--prettyshow uptime in pretty format
--helpdisplay this help and exit
--sincesystem up since
--versionoutput version information and exit
--pretty option will show uptime output in a pretty format:
It will print only how long the system has been running:
up 1 day, 1 hour, 29 minutes
--since option shows the date and time since the system is up:
-h will show the general help as below:
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).
Last option uptime
-V will print the version information.
uptime from procps-ng 3.3.12
As you see, the uptime command is easy to understand and use. It gives you information about current logged in users, current time and how long your system has been running and the average system load.
If you have any question, leave a comment below.