Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just setup an EC2 instance running Linux. Is there a way to get the version/distribution of Linux that is running on the instance via the terminal?

share|improve this question
uname -a should give you the information about the Kernel, build time, and some other info, including vendor... (courtesy of Tiernan0) – soandos May 31 '11 at 20:00
up vote 14 down vote accepted

For distro info:

cat /etc/issue

For Kernel/architecture (as mentioned previously):

uname -a
share|improve this answer
cat /etc/issue worked. – David Jun 2 '11 at 15:15

The portable command for Linux Standard Base-compatible distributions (which is pretty much everything popular) is lsb_release. The distribution can be obtained by "-i" and the version comes from "-r". The "-s" option suppresses the name column and just shows the value, and -a shows everything lsb_release knows about the system. So, for example on a RHEL 5.5 system:

$ lsb_release -s -i

$ lsb_release -s -r

$ lsb_release -a
LSB Version:    :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: RedHatEnterpriseServer
Description:    Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Release:        5.5
Codename:       Tikanga

If you're on Red Hat, SuSE, Ubuntu, Debian, or anything else derived from those (Fedora, CentOS, whatever), this command will work. Otherwise, you'll have to figure out some distro-specific info. RedHat, for example again, installs a package named redhat-release and creates a file in /etc:

$ rpm -q redhat-release

$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.5 (Tikanga)

But you really should use lsb_release if it's available. If you're just doing it visually, lsb_release -a is easy to remember and reasonably easy to read.

share|improve this answer
I your first approach and get the following error -bash: lsb_release: command not found. I also tried your second approach and can't find anything mentioning redhat in /etc. Any other suggestions? – David May 31 '11 at 21:42
Start by checking to see if rpm and apt-get are on the system; run "which rpm" and "which apt-get". If you have rpm, do an "rpm -qa | less" and see if there's anything there that sounds like a distribution. If you have apt-get, try "dpkg -l | less" and do the same thing. And try "ls -d /etc/*rel*" to see if there's any release file or anything in /etc. Oh, you might also do a "find / -name lsb_release" just in case lsb_release isn't in your path. – dannysauer May 31 '11 at 22:17
apt-get is not on the system. I don't see anything identifiable with rpm -qa|less. ls -d /etc/*rel* worked. I then nano /etc/system-release. In the file it tells me that the OS is Amazon Linux AMI release 2011.02.1.1. Thanks. – David Jun 2 '11 at 15:15

uname -a should give you the information about the Kernel, build time, and some other info, including vendor...

share|improve this answer

As you can see when log into an AMI EC2 Amazon Linux AMI:

"See /usr/share/doc/system-release/ for latest release notes."

So... just type:

cat /usr/share/doc/system-release/ReleaseNotes.txt
share|improve this answer
This worked for me in Amazon Linux AMI 2011.09. – Mauvis Ledford Apr 3 '15 at 20:34

This worked for me:

# cat /etc/os-release

NAME="Amazon Linux AMI"
ID_LIKE="rhel fedora"
PRETTY_NAME="Amazon Linux AMI 2015.03"
share|improve this answer
Just a heads up. I am running Amazon Linux AMI 2011.09 and this did not work but another comments cat /usr/share/doc/system-release/ReleaseNotes.txt did. This probably works on newer editions. – Mauvis Ledford Apr 3 '15 at 20:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.