uptime Command: Tutorial & Examples
Display the current uptime of the system
uptime command is used to display the system uptime, which is the length of time that the system has been running since its last reboot. The uptime is displayed in the form of days-hours:minutes, and the current time is also displayed.
In addition to the uptime,
uptime also displays the current load average, which is a measure of the system's workload. The load average is a rolling average of the number of processes that are waiting for CPU time over the past 1, 5, and 15 minutes. A high load average can indicate that the system is overloaded and may be experiencing performance issues.
Here is an example of the uptime command and its output:
uptime 22:39:01 up 4 days, 7:43, 2 users, load average: 0.00, 0.01, 0.05
In this example, the system has been running for 4 days and 7 hours, and there are currently 2 users logged in. The load average is currently low, indicating that the system is not heavily loaded.
To display the uptime in a more compact format, you can use the
uptime -p up 4 days, 7:43
You can also use the
-s flag to display the uptime in seconds:
uptime -s 1609447981
This can be useful if you need to use the uptime value in a script or other automation tool.
CleverUptime uses the
uptime command to detect reboots of the system.