uptime Command in Linux with Examples

uptime command in Linux is used to display the system’s current uptime, which refers to the time duration for which the system has been running since its last boot. It also provides information about the system’s load average over different time periods.

Syntax:

The basic syntax for the uptime command is

uptime

Example:

Displaying System Uptime and Load

$ uptime

Output:

advertisement
advertisement
 13:37:45 up 19:10,  2 users,  load average: 0.00, 0.06, 0.11

The uptime command provides the following information:

  • Current time: 13:37:45
  • System uptime: The system has been operational for 19 hours and 10 minutes since the last boot.
  • Number of users: There are currently 2 users logged into the system.
  • Load average: It displays the load average for the past 1, 5, and 15 minutes respectively. In this case:
    • Load average for the past 1 minute: 0.00
    • Load average for the past 5 minutes: 0.06
    • Load average for the past 15 minutes: 0.11

Advanced Options:

Note: Join free Sanfoundry classes at Telegram or Youtube

The uptime command provides additional options for enhanced functionality:

  • -p, –pretty: Displays the uptime in a more human-readable format, removing the seconds from the days:hours:minutes representation.
  • -s, –since: Displays the system’s uptime since a specific date or time. The format for the date and time can be specified using the -s option along with the desired format.
  • -V, –version: Displays the version information for the uptime command.

Advanced Options Examples:

Example 1: Display Uptime in a User-friendly Format

uptime -p

The -p option presents the system’s uptime in a more human-readable format, showcasing the duration the system has been up in a user-friendly manner, excluding seconds.

advertisement

Output:

up 1 week, 2 days, 5 hours

Example 2: Show System Uptime Since a Specific Date/Time

uptime -s

The -s option displays the system’s uptime since a specific date and time. In this case, it indicates the date and time when the system was last booted.

advertisement

Output:

2023-11-10 08:30:00

Example 3: Display Version Information

uptime -V

Output:

uptime from procps-ng 3.3.12

The -V option provides the version information for the uptime command, showing the version and related details about the command utility (procps-ng in this case).

Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.

If you wish to look at all Linux commands and their usage examples, go to Linux Commands Tutorial.

If you find any mistake above, kindly email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.