Linux system comes with various command-line tools to find your server uptime. That means how long the system up since the last startup.
There are a few ways to check system uptime, here we learn about the Linux uptime command.
- Basic command level knowledge.
- Difficulty level - Easy.
- Root or normal user level access.
Linux uptime Command
Uptime command is one of the very basic Linux commands. It is generally used to display how long the system has been active or running.
Uptime command provides:
- the current time.
- how long system is in running state.
- how many users currently logged into the system.
- system load averages for the last 1,5 and 15 minutes.
How to use uptime command
Simply type uptime from the terminal:
uptime outputs one-line display with the following information:
01:33:02 up 51 days, 13:02, 1 user, load average: 0.11, 0.03, 0.01
where you can read uptime output as,
01:33:02 - is the current time.
up 51 days - the system running up for the last 51 days.
1 user - user count (the number of logged in users).
load average: 0.11, 0.03, 0.01 - shows the system load averages over the last 1, 5, and 15 minutes respectively. These three values help to see the load increasing or decreasing.
You can find the same system uptime information in the first line of the output of w command.
The load average is the system load over a period of time. Technically it is a sampling of processes waiting for disk read or currently executing on CPU and waiting in the run queue for CPU.
Uptime command examples
Uptime command has got a few options, let's check those and outputs.
To show system uptime in a pretty format or in a human-readable format:
up 7 weeks, 2 days, 13 hours, 26 minutes
Use -s option to show the time/date since when the system is up:
To show the version and exit
uptime from procps-ng 3.3.16
To show the help page and exit
In this tutorial we learned about uptime command to check the amount of time the system has been running, the number of users logged in, and system load averages.