Is there a way to determine what version (distribution & kernel version, I suppose) of Linux is running (from the command-line), that works on any Linux system?
The kernel is universally detected with
There really isn't a cross-distribution way to determine what distribution and version you're on. There have been attempts to make this consistent, but ultimately it varies, unfortunately. LSB tools provide this information, but ironically aren't installed by default everywhere. Example on an Ubuntu 9.04 system with the
Otherwise, the closest widely-available method is checking
Here are some examples.
But Debian has
Fedora, Red Hat and CentOS have:
I don't have a SUSE system available at the moment, but I believe it is
For most of the popular distributions then,
will most often work. Stripped down and barebones "server" installations might not have the 'release' package for the distribution installed.
Note that many distributions have this kind of information in
You could also try:
$ cat /etc/issue
It usually (not always, though) will tell you what distribution you are using. /etc/issue is the file used for login screen.
at a minimum for Ubuntu and OpenSUSE.
Does not work for OS-X at least until 10.9 (Mavericks) Use sw_vers instead
OpenSUSE has cat /etc/SuSE-release up until 13.1 but is deprecated in favour of os-release.
Redhat 6.1 has cat /etc/redhat-release
protected by BinaryMisfit Dec 20 '10 at 14:27
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?