The “uptime” Command in Linux [5 Practical Examples]

LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now

The uptime command in Linux is an essential tool for anyone who needs to monitor the performance of a Linux system. Whether you are a system administrator, a developer, or simply a user, understanding the basic usage of this command and its advanced features can help you optimize your system and make decisions while troubleshooting. In this article, I will explore the basic usage of the uptime command, as well as some of its options and features, with some practical examples.

A. Description

The uptime command in Linux is a simple but powerful tool for monitoring the performance of your system. It provides helpful information about the amount of time the system has been running, the number of users currently logged in, and the system load averages for a specified period of time. This information is important for the system administrators.

B. Syntax

The syntax of the uptime command in Linux is simple, as shown below.

uptime [OPTION]...

Note: In the syntax above, the OPTION enclosed by the square brackets means it is not mandatory and three dots after the square brackets mean multiple OPTIONS can be used simultaneously after the uptime command.

C. Options

The uptime command has multiple options available. Here, I have listed a few of them. However, you can learn more about the uptime command, its options and their uses by checking the man page.

man uptime

Useful Options

  • -p, –pretty: Shows uptime information in a human-readable format.
  • -h, –help: Displays this help page
  • -s, –since: Prints the date and time since the system has been up, in yyyy-mm-dd HH:MM:SS format.
  • -V, –version: Displays version information.

Note: Commands and their options are case-sensitive in Linux. So, be careful while using them.

Practical Examples of the “uptime” Command in Linux

In Linux, the uptime command is a helpful tool to get information about the system and monitor its performance. In the section below, I will show you some of the most useful applications for the uptime command in Linux.

Example 1: Displaying the Gross Status of the System Uptime

The uptime command in Linux allows you to see the gross status, i.e., the starting time of the system, the amount of time that the system has been running, the number of users currently logged in, and system load averages for a specified period of time. In this example, I will show you the uptime status of my system. You can do the same by following the steps below.

Steps to Follow >

➊ First, open the Ubuntu Terminal.

 Then, execute the following command.

uptime

➌ Finally, press the ENTER key.

Output >

In the following image, you can see that I have displayed the uptime status of my system.Showing the gross uptime of the system using the uptime command in linux.

Note: The uptime command gives an output in the order given below.

  • Starting time of the system.
  • Amount of time that system has been running.
  • The number of users currently logged in.
  • System load averages for a specified period of time.

Similar Readings


Example 2: Check the Start Time of the System Using the “uptime” Command in Linux

You can check the starting time of the system by using the uptime command followed by the option -s. In this example, I will show you the starting time of my system. You can do the same by following the steps below.

Steps to Follow >

➊ At first, open the Ubuntu Terminal.

 Then, execute the following command.

uptime -s

➌ Then, press the ENTER key.

Output >

In the following image, you can see that I have displayed the starting time of my system.Showing the starting time of my system.

Example 3: Check Linux Server Uptime in a Convenient Format

The uptime command, along with option -p allows you to see the amount of time the system has been running. Instead of displaying the uptime as the number of seconds since the system started, it displays the uptime in days, hours, minutes, and seconds. Here, I will show you the amount of time that my system has been running using the option -p with the uptime command. You can follow the steps below to get the same for your system.

Steps to Follow >

➊ First, open the Ubuntu Terminal.

 Next, run the command to see the amount of time the system has been running.

uptime -p

➌ Finally, tap the ENTER button.

Output >

As you can see in the image below, I have displayed the amount of time that my system has been running in a more convenient format.Showing the amount of time that my system has been running.

Example 4: Get Help About the “uptime” Command in Linux

In Linux, the help page for the uptime command contains a brief description of the command. You can see the help page by following the steps mentioned below.

Steps to Follow >

➊ At first, open the Ubuntu Terminal.

 Then, type the following command into the command prompt:

uptime --help

➌ Now, press the ENTER button.

Output >

In the image below, you can see the help page for the uptime command in Linux.Showing the help page for the uptime command in Linux.

Example 5: Get the Version of the “uptime” Command in Linux

You can see the current version of the uptime command on your Linux machine with the -V or –version option. Here, I will show you the version of the uptime command for my machine on the terminal. You can do the same by following the steps below:

Steps to Follow >

➊ Open the Ubuntu Terminal.

 Next, run the following command.

uptime -V

Alternatively,

uptime --version

➌ Press the ENTER key.

Output >

In the following image, you can see that I have displayed the version of the uptime command in Linux.Showing the version of the uptime command in Linux.

Conclusion

The uptime command in Linux is a simple and powerful tool for monitoring performance on the system. By utilizing its various options, you can understand your system’s resource utilization and make decisions about system optimization. I have designed this article aiming to provide a comprehensive guide to the uptime command, with practical examples to help you get started and become an advanced user.


Similar Readings

Rate this post
S. M. Amdadul Islam

Hello everyone. I am S. M. Amdadul Islam, currently working as a Linux Content Developer Executive at SOFTEKO. I am a Naval Architecture and Marine Engineering (NAME) graduate from the Bangladesh University of Engineering and Technology. In addition to my regular work, I enjoy watching Youtube, discovering new things, gossiping with friends, visiting new places, and taking photos of landscapes. Read Full Bio

Leave a Comment