Linux Commands Examples

A great documentation place for Linux commands


Tell how long the system has been running.

see also : ps - top - w


uptime [options]

add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!



What does load average mean in unix/linux?

In general it measures the number of active processes at a given time, but the metrics used to calculate it differ on some systems. The only article I've found that explains it fairly well is this one.


Linux: Getting date & time of system startup

I found some commands here. Try who -b or last reboot | head -1.
who gives numeric dates, while last reboot returns abbreviated day / month names.


Server uptime checker?

If all you want to do is find out if its up, write a script to ping the server every 10 min or so. If you want something that will actually check functionality (like delivering a web page) write a javascript snippet that will refresh your page every n minutes.


"Load average" stuck on 7.0

Your numbers appear to be valid and below over-utilization. A fully utilized system with eight cores (or CPUs) would have a load average of 8.0. Currently the load average is at roughly 88%. This is why the system does not exhibit any performance issues.


From wikipedia

An idle computer has a load number of 0. Each process using or waiting for CPU (the ready queue or run queue) increments the load number by 1. Most UNIX systems count only processes in the running (on CPU) or runnable (waiting for CPU) states. However, Linux also includes processes in uninterruptible sleep states (usually waiting for disk activity), which can lead to markedly different results if many processes remain blocked in I/O due to a busy or stalled I/O system[1]. This, for example, includes processes blocking due to an NFS server failure or to slow media (e.g., USB 1.x storage devices). Such circumstances can result in an elevated load average, which does not reflect an actual increase in CPU use (but still gives an idea on how long users have to wait).

This means that your Java threads are responsible for the load because (guessing) most things in util.concurrent are seen by the OS as IO-blocking. You can begin investigating these processes with tools that are mentioned answers to this question: how-to-find-out-which-process-is-consuming-wait-cpu?


How to find uptime of a linux process

ps -o "cputime=" $pid

See "Standard format specifiers" in the ps manual page.

(The = character in -o causes the header to be disabled.)


average load and total %CPU in top

The reason your CPU % and load average are not agreeing is because they are two completely different values. The CPU % is exactly that, the percentage of the CPU a process is using. The load average is the weighted average of the processes in the run queue over 1, 5, and 15 minutes.

If you are concerned with how much CPU you are using (are you fully utilizing your CPU), your tally of the output of top will work well. You can run that occasionally and record the value (or use sar, which will do that for you).

Having a high load average means you have a lot of processes in the run queue - many processes are ready and waiting to run. High load doesn't automatically mean a lot of CPU usage.

Wikipedia has a good article describing the load average, and the differences between CPU load and CPU usage:


How to find the uptime since last wake from standby

What are you using to initiate the standby?

If you can use a script, then after the line

echo -n "standby" > /proc/acpi/sleep

you could have the line

echo `date +%s` >> /var/log/wakeups.log

Or something similar. This would mean that the first thing the machine did when it woke up was to write the current time and date to a log file (n seconds since epoch).

Then tail -1 /var/log/wakeups.log would give you the last time. You could could subtract this from the current time to get seconds since the last wakeup.


How to track computer's uptime

You can create a script which runs uptime & dumps it into a file.

uptime >> uptime.log

After that setup a cron job for it. To know more about how to create a cron job : Create Cron Job

Or you can sign-up for an online service to do it for you : Uptime Project


How to find out the time Linux machine have spent in sleep

Possible Duplicate:
How to find the uptime since last wake from standby

Top Answer:
"In /var/log/pm-suspend.log, look for the last line looking like this one:

Sun Dec 16 09:30:31 CET 2012: Awake. That's your last wakeup time. You can calculate your uptime since then the way Paul suggested."


uptime gives a one line display of the following information. The current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes.

This is the same information contained in the header line displayed by w(1).

System load averages is the average number of processes that are either in a runnable or uninterruptable state. A process in a runnable state is either using the CPU or waiting to use the CPU. A process in uninterruptable state is waiting for some I/O access, eg waiting for disk. The averages are taken over the three time intervals. Load averages are not normalized for the number of CPUs in a system, so a load average of 1 means a single CPU system is loaded all the time while on a 4 CPU system it means it was idle 75% of the time.


-h, --help

display this help text

-V, --version

display version information and exit



information about who is currently logged on


process information

reporting bugs

Please send bug reports to procps[:at:]freelists[:dot:]org (procps[:at:]freelists[:dot:]org)

see also

ps , top , utmp, w


uptime was written by Larry Greenfield (greenfie[:at:]gauss.rutgers[:dot:]edu) and Michael K. Johnson (johnsonm[:at:]sunsite.unc[:dot:]edu)

How can this site be more helpful to YOU ?

give  feedback