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
 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:

Free 30-Day Java Certification Bootcamp is Live. Join Now!

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.

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.

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
I’m Manish - Founder and CTO at Sanfoundry. I’ve been working in tech for over 25 years, with deep focus on Linux kernel, SAN technologies, Advanced C, Full Stack and Scalable website designs.

You can connect with me on LinkedIn, watch my Youtube Masterclasses, or join my Telegram tech discussions.

If you’re in your 40s–60s and exploring new directions in your career, I also offer mentoring. Learn more here.