Skip to content

What is uptime Linux command?

The Linux uptime command is used to check the system’s running time, as well as load averages. It displays the current time, how long the system has been running, the number of users currently logged on, and load averages for the past 1, 5, and 15 minutes.

uptime Syntax:

Terminal window
uptime [options]

uptime Options:

OptionDescription
-pDisplay current uptime in a more human-readable format
-sDisplay the time since the system was started
-VDisplay version information

Parameters:

None

uptime Command Usage Examples:

Display System Uptime

Terminal window
uptime

Shows how long the system has been running along with the current time, number of users, and load average.

Display System Uptime in a Specific Format

Terminal window
uptime -p

Displays the uptime in a more human-readable format, showing only the time since the system was last booted.

Display Uptime with Refresh Interval

Terminal window
watch -n 1 uptime

Updates the uptime display every 1 second, providing a real-time view of system uptime.

Display Uptime and Load Average

Terminal window
uptime -s

Prints the system start time along with the current system time. Additionally, it shows the current number of users and load averages.

Show the Uptime History

Terminal window
last reboot

View the reboot history of the system, showing when the system was last rebooted.

How do I use uptime in Linux?

To use the uptime command in bash, execute the following command:

Terminal window
uptime

What information does uptime command provide?

The uptime command displays 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.

Terminal window
uptime

How can I format the output of the uptime command?

You can format the output of the uptime command to display in a more user-friendly way using the uptime -p option. This will show the uptime in a more human-readable format.

Terminal window
uptime -p

How can I see the system’s load averages with uptime?

To display just the system’s load averages without the other information provided by uptime, you can use the -q or --load-average option.

Terminal window
uptime -q

How can I check when the system was last booted?

If you want to find out when the system was last booted along with the uptime information, use the -s or --since option.

Terminal window
uptime -s

Can I see the number of logged-in users using uptime?

Yes, you can see the number of users logged in using uptime by using the -u or --users option.

Terminal window
uptime -u

How can I get continuous updates of system uptime?

To get continuous updates of the system’s uptime, you can use the watch command along with uptime. This will periodically run the uptime command and display the output.

Terminal window
watch uptime

How can I get a snapshot of the current system load with uptime?

If you want a snapshot of the current system load without the uptime information, you can use the -s or --sysinfo option.

Terminal window
uptime -s

Applications of the uptime command

  1. Checking how long the system has been running since the last reboot.
  2. Monitoring system availability and performance.
  3. Evaluating system stability and reliability.
  4. Determining peak usage times for maintenance scheduling.
  5. Troubleshooting system crashes or performance issues.