How To Use Uptime Command In Ubuntu Linux
Spread the love

What is Uptime?

Uptime is a measure of system reliability, expressed as the percentage of time a machine, typically a computer, has been working and available. Uptime is the opposite of downtime. Conversely, long uptime may indicate negligence, because some critical updates can require reboots on some platforms.

What will we look at?

Introduction to Uptime and examples

In this tutorial we will look at the uptime command in Linux, as well as apply some examples of its use. Users of Linux systems can use the BSD uptime utility, which also displays the system load averages for the past 1, 5 and 15 minute intervals

First, let’s look at its basic syntax.

# uptime 23:01:11 up 21 min, 1 user, load average: 0.02, 0.01, 0.18
Code language: Bash (bash)

From here it is best to look at what options it offers us.

# uptime -h Usage: uptime [options] Options: -p, --pretty show uptime in pretty format -h, --help display this help and exit -s, --since system up since -V, --version output version information and exit For more details see uptime(1).
Code language: Bash (bash)

The most commonly used options are -p (pretty) and -s (since), so we will show you two examples with them.

# uptime -p up 21 minutes # uptime -s 2021-03-21 23:01:11
Code language: Bash (bash)

Bonus idea for uptime checks

If you don’t have the uptime command in your system you can use the proc uptime method ‘/proc/uptime’. This method shows how long the system has been on since it was last restarted. Here is a simple example:

# cat /proc/uptime 320715.43 3234388.80
Code language: Bash (bash)

Conclusion

In conclusion, we can say that the command is short, simple and takes no time to remember and learn, but is used very often among system administrators of Linux distributions and more.

Here is a simple 60 second video on the command and a simple review

Facebook Comments Box