Determine Linux version

Posted October 5, 2004 by Quinn McHenry in Linux

When visiting a new Linux system, it may not be known which of the many flavors and versions the system is. This recipe describes a couple of techniques for determining the version of Linux running on a host.


The command uname -a will generate output like

Linux poly.tech-recipes.com 2.6.5-1.358 #1 Sat May 8 09:04:50 EDT 2004 i686 i686 i386 GNU/Linux

This can be interpreted as:

kernel name: Linux
hostname: poly.tech-recipes.com
kernel release: 2.6.5-1.358
kernel version: #1 Sat May 8 09:04:50 EDT 2004

The specific distribution information is missing from the uname output. Many distributions put this information in a file in /etc like /etc/redhat-release, /etc/debian_version, /etc/gentoo-release, and so on. For the system described by the uname output above, the file /etc/fedora-release contains the following text:

Fedora Core release 2 (Tettnang)

 

About Quinn McHenry

Quinn was one of the original co-founders of Tech-Recipes. He is currently crafting iOS applications as a senior developer at Small Planet Digital in Brooklyn, New York.
View more articles by Quinn McHenry

The Conversation

Follow the reactions below and share your own thoughts.