Uptime ClockIf you’re running Linux, chances are that you know what distribution you’re running, as well as the version of that distribution, and all those other pertinent details that can come in handy.

In fact, you probably have it memorized down to the very last three decimal points of the version, and also know what date it was last updated.

What’s that? You don’t?!

Often-times, for those of us who just do not memorize such details, we need a quick way to look them up.

Please don’t tell me that you think I’m going to send you to the GUI for this. Hint: I’m not going to send you to the GUI for this.

You can learn everything you never wanted to know about your distribution, as well as the system’s uptime, from the Linux command line.

Displaying Kernel & Distribution Details

It stands to reason that you might know your local system’s distribution/version/etc. details off the top of your head.

If you commonly access other systems (because now that you know how to use remote administration tools, you’re using them all the time, right?), you might not know such details about those systems.

In any case, there are a few ways to find out what you need to know, without ever leaving the command line.

The uname command prints system information.

Used without options, I get a very brief result: Linux

Um, ok. Where are the details I was promised?!

The -a option shows all of the system information. How’s that for details!

The -r option shows the kernel release/version.

The -s option prints the kernel name (like using uname without options!)

The -o option shows the operating system. Example Result: GNU/Linux

The -i option shows the hardware platform.

The -m option shows the machine hardware name.

The arch command prints the machine hardware name, identical to uname -m.

The cat command can be used to concatenate and print files from the /etc directory, such as the following:

cat /etc/issue prints (on my system): Fedora release 21 (Twenty One)

cat /etc/*release prints a culmination of the release files in the /etc directory.

Showing Uptime & Uptime History

The uptime command shows how long the system has been running.

Uptime is an important statistic on servers, but perhaps less so on personal machines.

Regardless, it is fun to look up now and again.

By default, the uptime command will show 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.

Example: uptime

Result: 23:04:20 up 4:20, 2 users, load average: 1.69, 1.41, 1.13

Using the -p option will “pretty up” the results and shorten it to just the uptime: uptime -p up 4 hours, 20 minutes

Using the -s option will show “since when” the system is up: uptime -s 2016-01-25 18:44:14

Displaying uptime history is a little more complicated.

The most simple solution I know of, it to search the reboot history with the grep command, and pipe it into the last command.

Example: last | grep reboot

This will give you a long list of reboots entries similar to the following:

reboot system boot 4.1.5-100.fc21.x Sat Jan 23 05:26 – 23:35 (18:08)

As you can see, the boot time and shutdown time are both displayed, along with the uptime for that period.


What distribution and/or statistical data am I missing, that you would like to see added to this topic?

Drop a note in the comments to let me know!