uptime Command Examples in Linux

The uptime command displays the time from when a system started running. The output of the uptime command gives information about the current time, how long the system is running, and how many users are currently logged in. Most relevant to CPU troubleshooting, however, is the load average field. A CPU’s load is expressed as the number of processes that are either using or waiting to use the CPU. It can also include the number of processes in the queue for storage I/O. Using uptime you can find the average load over three different periods of time, from left to right in the output: the last 1 minute, the last 5 minutes, and the last 15 minutes.

You can use these values to determine when your CPU becomes overloaded, which may lead to performance issues. For example, if you have 4 logical cores, and the load average in the last 15 minutes is 4.0, then your CPU was being used fully. If your load average were 8.0, then your CPU would be 100% overloaded.

Here is an example of the uptime command:

$ uptime
 10:54pm  up 8 days,  3:44,  3 users,  load average: 0.89, 1.00, 2.15

This information is, from left to right: the current time (10:54pm), system uptime (8 days, 3 hours, 44 minutes), number of users logged in (3), and system load average for three time periods: one minute (0.89), five minutes (1.00), and fifteen minutes (2.15). The load average is the average number of processes ready to run in that time interval.

uptime Command Examples

1. Print current time, uptime, number of logged-in users and other information:

# uptime

2. Show only the amount of time the system has been booted for:

# uptime --pretty

3. Print the date and time the system booted up at:

# uptime --since

4. Show version information:

# uptime --version
Related Post