cat /etc/issue

Display which distro is installed


71
By: root
2009-02-03 09:59:24
cat

5 Alternatives + Submit Alt

What Others Think

Doesn't work with Gentoo
scottix · 483 weeks and 6 days ago
Is lsb_release a better command for this?
int19h · 483 weeks and 3 days ago
ls /etc/*release is better IMO, "issue" contais welcome message
unixmonkey1054 · 483 weeks and 3 days ago
ls /etc/*release ls: /etc/*release: No such file or directory cat /etc/issue cat: /etc/issue: No such file or directory uname -rms FreeBSD 7.1-STABLE i386 uname works better
grep · 483 weeks and 3 days ago
How about this one, does it work for everybody? grep -qs "" /etc/lsb-release && lsb_release -a | grep -v n/a | grep -v none; uname -rms
int19h · 483 weeks and 2 days ago
Checked it on Solaris, and noted that no such info was printed - it was a custom message set by the admin.
rommelsharma · 483 weeks and 1 day ago
Hrm.. How about test `uname` = Linux && lsb_release -a || ( test `uname` = SunOS && cat /etc/release || uname -rms )
mulad · 483 weeks and 1 day ago
Here's a csh script I use to find the OS version. Works on various Linuxes and Mac OS X: #!/bin/csh -f if(-r /etc/fedora-release) then cat /etc/fedora-release else if(-r /etc/lsb-release) then perl -ne 'if(/DESCRIPTION/) { s/.*="(.*)"/$1/; print; }' /etc/lsb-release else if(-r /etc/debian_version) then echo "Debian `cat /etc/debian_version`" else if(-d /System/Library) then set version_plist=System/Library/CoreServices/SystemVersion.plist foreach vol (/Volumes/*) if(-r "$vol/$version_plist") then set name=`defaults read "$vol/${version_plist:r}" ProductName` set build=`defaults read "$vol/${version_plist:r}" ProductBuildVersion` set version=`defaults read "$vol/${version_plist:r}" ProductUserVisibleVersion` printf "%-16s %10s %-10s %10s\n" "${vol:t}" "$name" "$version" "(build $build)" endif end else uname -s -r endif
rae · 483 weeks ago
rpm -qf /etc/*-release
megacoder · 429 weeks and 3 days ago
This is the best alternative, but it's not bullet proof. /etc/issue can be any custom message provided by the administrator. While it might work on home machines, or small business servers, it's unlikely to give you anything useful in schools, government organizations, large corporate enterprises, etc. Fact of the matter is, when you're using an operating system, for whatever purpose, you should know what it is long before you start using it. FYI.
atoponce · 417 weeks ago
lsb_release -is
saksmt · 115 weeks and 6 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: