The uptime command in Linux

Hello, friends. This time we are going with a command that is basic to use but that can also help us in administrative tasks. So in this post, you will learn how to use the uptime command in Linux. This command is one of the most basic in the use of the system.

The uptime command in Linux

The main function of the uptime command in Linux is to show how long the system is active. This tool, for example, can indicate how long the computer has been on. Very interesting if we are administrators of a network of devices with Linux.

However, the uptime command also displays information such as the current system time, the number of active users and the system load. Therefore, it is a command that, although basic to use, you can help us in administrative tasks.

This command is available in all existing Linux distributions, so to use it, we do not have to install or configure anything.

So let’s go for it, friends.

Using the uptime command in Linux

The most common way to use the uptime command in Linux is to use it without any arguments.

uptime

This will return the following output on the screen

14:20:15 up 2 days, 2:51, 1 user, load average: 0.02, 0.04, 0.01

This screen output shows the following information

  • Current system time
  • System active time
  • number of active users
  • Average system load for the last 1, 5, and 15 minutes.

Keep in mind that the system load is affected by the CPU and disk load. So, you have to take it as a whole and not only refer to CPU usage.

This output, although basic, can help us with some monitoring and system administration tasks.

The options of the uptime command

The options that modify the behavior of the uptime command are really few. If we want to improve the screen output, we can use the -p option, which comes from pretty.

To complete this, you can run the following command

uptime -p

And you will have a screen output similar to the following one

up 1 week, 1 hours, 5 minute

Another option is -s. This option will only display the date and time since the command is running.

uptime -s

Example output

2022-01-02 13:05:41

This is how easy it is to use the uptime command.

Conclusion

This command is a simple-to-use command that helps us to know how long the system has been active.

I hope you liked the post.

Share This:

Leave a Comment

Your email address will not be published. Required fields are marked *