HOW TO: Determine which flavor or version of Linux is installed

If you are working with a Linux or Unix server, you may not even know which operating system release is on the server or even if it is a 32 bit or 64 bit machine. How do you even tell if your server is 32bit or 64bit? Usually this is not too terribly important. Most of the commands just work. However, it can become important when you want to install or upgrade the server software.

Fortunately, getting the OS version and machine information is JUST as simple..

cat /etc/*-release

That one line will work all versions that anyone who needs to read this article will ever run into.*

Debian: /etc/debian_version, /etc/debian_release (rare)
Fedora Core: /etc/fedora-release
Gentoo Linux: /etc/gentoo-release
Mandrake: /etc/mandrake-release
Mandriva/Mandrake Linux: /etc/mandriva-release, /etc/mandrake-release, /etc/mandakelinux-release
Novell Linux Desktop: /etc/nld-release
Red Hat: /etc/redhat-release
Solaris SPARC: /etc/release
Sun JDS: /etc/sun-release
SUSE Linux: /etc/SuSE-release, /etc/novell-release
SUSE Linux ES9: /etc/sles-release
Ubuntu Linux: /etc/lsb-release

This will produce results like:

CentOS release 5.5 (Final)


Red Hat Enterprise Linux Server release 5.4 (Tikanga)


The next thing you need to know is if the kernel you have installed is 64 bit ot 32 bit. You can do that via this command

cat /proc/cpuinfo



Here is an example of a 32bit kernel: (Notice the x86)

Linux version 2.6.18-164.el5PAE ( (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Tue Aug 18 15:59:11 EDT 2009

Here is an example of a 64bit kernel:(Notice the x64)

Linux version 2.6.18-028stab070.5 (root@rhel5-build-x64) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Fri Sep 17 15:37:23 MSD 2010

I hope this helps!




If you have built your own server, there is a possility you have to run a slightly different command line as some version use *_version as the file name.

These flavours include:

Red Hat: /etc/redhat_version
Slackware: /etc/slackware-version
Knoppix: knoppix_version

So if the above line produced no results try:

cat /etc/*version

See more examples of these files here on Linux Mafia