Boast How Long Your Linux System Has Been Running Using uptime

Linux uptime
Linux uptime.


The one thing that Linux is known for is its stability. I'm not necessarily talking about desktop Linux with pretty GUI desktop environments but the bog standard terminal interface that we have all come to love.

Windows users can boast about things like "does it run Microsoft Office" and "there is no decent video editing software" but can they boast an uptime of 365 days or more.

Of course to be able to boast about how long your system has been up you need to know the command which shows how long it has indeed been up.

This guide will show you how to do just that.

Now obviously if you are running on a laptop then your uptime might be considerably small unless you have spent hours playing games, watching online video or indeed working.

The system uptime is far more impressive on a desktop computer left running continuously, a server or everybody's favourite single board computer, the Raspberry PI.

How Long Has Your System Been Running

The simplest way to find out how long your system has been running is to type the following command into a terminal window:


The default output for the uptime command is as follows:

  • The current time
  • How long the system has been running
  • How many users are logged in
  • The load average for the past 1, 5 and 15 minutes

The load averages show the average number of processes that are in a runnable or uninterruptable state.

Displaying Just The System Uptime

The uptime command on its own is fairly informative but displaying this information to people in a way that says "Hey look how long my system has been running" can be a little too verbose.

You can display just the uptime in a readable manner using the following command:

uptime -q

The output from the uptime -q command is something like this:

up 1 hour, 41 minutes

If your system has been up a considerably long time then the output may be something like this

up 4 years, 354 days, 29 minutes

It might be nicer to show when the system was last restarted.

To do this run the following command:

uptime -s

The output from the uptime -s command is as follows: 

2016-02-18 18:27:52

If you really want to show off (and I know somebody who does) you can use Twitter from the command line to show the world how long your system has been running.

This guide shows how to tweet from the command line.

If you add the command from the linked tutorial to a cron job you can tweet every day to twitter to show how long your system has been running.

Alternate Way To Show Your System Uptime

The uptime command isn't the only way to show the system uptime. You can achieve the same thing with just 2 key presses:


The second keypress is obviously the return key.

The output from the command is as follows:

  • user
  • tty
  • from
  • login time
  • idle time
  • JCPU
  • PCPU
  • WHAT

The command shows more than just the current uptime. It shows who is logged in and what they are currently doing.

The JCPU is the time used by all processes attached to the terminal and the PCPU shows the time used by the current process in the WHAT column. 

The command has a few switches that you can use. For instance to turn off headings run the following command:

w -h

You can also display a shorter version using the following command:

w -s

The above command shows the following output:

  • user
  • terminal
  • from
  • idle
  • what

If you wish to omit the from field run the following command:

w -f


So there you have it. You now know how to show how long your system has been running and you can also find out other useful information about your system's usage.

Further Reading

If you liked this guide why not try out one of the following:


More From Us