uptime command in Linux

This uptime command guide is a follow-up to my previous 90 Linux Commands frequently used by Linux Sysadmins article. As time allows, I will continue to publish articles on these 90 commands geared toward Linux sysadmins and power users. Let’s continue this series with the uptime command.

The uptime outputs the current time, system uptime, number of logged-in users and current load average. If an argument is included, it is used as the file to be read to discover how many users are logged in. If no argument is specified, then a system default is used.

Linux uptime

Syntax: uptime [options]

Here’s the output on a server I manage:

$ uptime
15:56:43 up 153 days, 4:12, 1 user, load average: 9.90, 9.80, 9.13

 

Linux uptime command examples

To print the current time, uptime, the number of logged-in users and other information, use:

uptime

To show only the amount of time the system has been booted for, use:

uptime --pretty

To print the date and time the system booted up, use:

uptime --since

To show uptime’s version information:

uptime --version

The above commands can also be shorted. For example:
-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.

Related commands:

  • top – Find files or directories under the given directory tree recursively.
  • w – show a list of currently logged-in user sessions.
  • ps – information about the currently running processes.

 

Conclusion

The uptime command is worthwhile to be used post command-line login on local and remote systems to provide a fast overview of the current time, system uptime, number of logged-in users and current load average.

Tags: , , ,



Top ↑