Uptime Command in Linux

Introduction

Before we discuss Uptime command in Linux, let's briefly understand-What is an Uptime Command ?

The uptime command in Linux provides information about how long the system has been running, the average system load, and the number of logged-in users. It is a simple and useful tool for monitoring system performance and determining the system's current state.

In this tutorial, we will talk about the uptime command. We will also address a few FAQs on uptime command in Linux.

How to Use the Uptime Command

The uptime command has the following syntax:

uptime [OPTIONS]

In order to see the system uptime, use the following command without any options:

uptime

You will get an output like below:

Output

22:20:33 up 620 days, 22:37,  1 user,  load average: 0.03, 0.10, 0.10
  • 22:20:33 - The current time on the system.
  • up 620 days, 22:37 - The amount of time the system has been operational.
  • 1 user - The total number of users who have logged in.
  • load average: 0.03, 0.10, 0.10 - Average system load during the last 1, 5, and 15 minutes.

The information presented by uptime is identical to the information in the w command's header.

On Linux, the load average can be a little perplexing. Unlike other operating systems, Linux displays system load averages rather than CPU load averages.

The number of jobs now operating or waiting for disk I/O is measured by the average system load. It essentially informs you how busy your system has been throughout the specified time period.

The system is usually idle if the load averages are 0.0. The load is increasing if the load average for the previous 1 minute is higher than the 5 or 15-minute averages. The load is diminishing otherwise.

Higher CPU consumption or disk workload usually causes the load average to rise.

uptime options

Only a few infrequently used options are accepted by the uptime command.

Uptime is told to present the output in a lovely format using the -p, --pretty option:

uptime -p

Only the length of time the system has been running will be displayed by this command:

Output

up 1 year, 36 weeks, 4 days, 23 hours, 15 minutes

The -s, --since option displays the system's uptime date and time:

uptime -s
Output

2017-09-01 23:43:32

Other choices include:

-h, --help - Show a help message before exiting.

-V, -version - Displays and exits the version information.

FAQs for Uptime Command in Linux

What does the uptime command display?

The uptime command displays the current time, how long the system has been running, the number of users currently logged in, and the system's average load over the last 1, 5, and 15 minutes.

How do I use the uptime command?

To use the uptime command, open a terminal and type uptime. The command will display the information about system uptime and load.

What is system load in the uptime output?

System load represents the average number of processes that are in a runnable or uninterruptible state. The load averages correspond to the last 1, 5, and 15 minutes.

How is system load calculated?

The system load is calculated by dividing the number of processes in the running or uninterruptible state by the number of available CPU cores.

What is a high system load?

A high system load indicates that the system is heavily loaded and may be working near its capacity. The interpretation of a "high" load depends on the system's hardware and usage pattern.

What does "up" mean in the output of uptime?

The "up" part in the output of uptime indicates the system's uptime, which represents how long the system has been running.

How do I interpret the system uptime in the uptime command output?

The system uptime is displayed in the format of days, hours, and minutes. For example, "1 day, 2 hours" indicates that the system has been running for one day and two hours.

Conclusion

The uptime command displays current time, online users, the length of time your system has been up and running, and the average system load.

If you have any queries, please leave a comment below and we’ll be happy to respond to them.