Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This question already has an answer here:

When using an unfamiliar Linux/BSD/Unix computer (e.g. by SSH) from the command line, how can you tell what distribution (and what version of that distribution) you're using?

Some options I've tried:

  • lsb_release --all: doesn't exist on OpenSuSE 11.3; works on Debian squeeze and Ubuntu 10.10.
  • uname --all: doesn't give distro information on SuSE and Debian; works in Ubuntu.
  • cat /etc/apt/sources.list in you can see which distribution's servers the machine connects to for updates. Obviously, only works for Debian-based distributions. Won't work if the computer has been configured to use a custom repository server.

Unfortunately none of these seem to work across many distributions. Is there a simple command to check?

share|improve this question

marked as duplicate by Peter Mortensen, Heptite, Tog, Kevin Panko, James Jan 10 at 15:48

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3 Answers 3

up vote 5 down vote accepted

If Python 2.3 or later is installed, this will work with many distributions:

python -c "import platform; print platform.dist()"
share|improve this answer

cat /proc/version

might do the trick.

share|improve this answer
1  
There are many unixes that don't support the /proc pseudo-filesystem. –  dmckee Oct 19 '11 at 16:08

There is no one magic command that works across all distributions - you will need to try a series of things to work out an answer.

Things to try include some you have done, like lsb_release, and others that you haven't like looking at /etc/redhat-release, /etc/fedora-release, etc.

share|improve this answer
    
Also /etc/SuSE-release. –  Mechanical snail Oct 19 '11 at 7:46
1  
Check /etc/*-release -- but there are systems with no such file(s). –  Keith Thompson Oct 19 '11 at 9:01

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