Linux Uptime Command
Linux is a vast environment, and everything can be controlled via command-line commands. From a small task to a bigger one, you can find a simple command that will do your work. If you do not have experience or new to the Linux environment, we suggest you have sound command-line knowledge as everything we do depends on the commands.
From a large pool of commands, we will discuss the “uptime” command in detail. Uptime command is as important as any other command in Linux. Also, if you are a Linux user, you should know the server working and their patch levels. Therefore, by using the “uptime” command, we can check various details of the running server.
What is the Uptime Command?
With the help of the uptime command, you can check the running time of your system. Along with the system’s running time, you can also get additional details of the system that includes the current time, count of users with the running sessions, and the system load averages for the last 1, 5, and 15 minutes. You can also customize the displayed information by using various options to get specific details about the server.
Running the uptime command of a Linux system via command-line, you will get an output specified in the following order.
- The current time of the system.
- The total uptime of the system.
- The active users that are currently running the system.
- The average of the system loads that is available for the past 1, 5, and 15 minutes.
If you use the system’s uptime command via command prompt, you will get many benefits out of it. For example, suppose you are facing any problem connecting to the server. Then, you can easily run the uptime command on the server to check if there has been a recent reboot on the server. This helps in troubleshooting the situation and provides you better visibility for applying the required solution.
Apart from this, you will also get detailed information and insight into your system’s stability. Linux is considered the most stable system and is rarely seen with an uptime of more than a year. A high uptime specifies the stability of the configurations.
Uptime Command with Examples
Below is the uptime command with various options.
Syntax
There is no need to use the options every time you run the uptime command. Running the below-mentioned uptime command, you will get the detailed output.
The output specifies the current time, “up” specifies that the system is up and running along with the total time the system is up to user count and the system load averages.
Uptime command comes with various options. To check the options, we can run the help command.
Apart from the help command, you can also run the man command for checking the usage of the “uptime” command.
With the use of the “-p” option, you can get a pretty clear output, displaying the uptime in the number of days, hours, minutes, and seconds format.
Another option is to check the exact time when the system was first started rather than the time spent since it was started. Run the below command on the command-line interface with the “-s” option.
If you want to check the version of the installed uptime package in the system, run the below command with the “-v” option.
Conclusion
Linux is a well-known environment and is highly recommended for various projects due to its stability and various configurations. However, every task is implemented using commands. One of them is the “uptime” command to check the system information. We have explained the “uptime” command with its various options.