commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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
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:
There is 1 alternative - vote for the best!
This should work on any RPM-based distribution. It's more reliable than trying to parse the content of the files.
If you can do better, submit your command here.
You must be signed in to comment.
Doesn't work with Gentoo
Is lsb_release a better command for this?
ls /etc/*release
is better IMO, "issue" contais welcome message
ls /etc/*releasels: /etc/*release: No such file or directory
cat /etc/issuecat: /etc/issue: No such file or directory
uname -rmsFreeBSD 7.1-STABLE i386
uname works better
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
Checked it on Solaris, and noted that no such info was printed - it was a custom message set by the admin.
Hrm.. How about
test `uname` = Linux && lsb_release -a || ( test `uname` = SunOS && cat /etc/release || uname -rms )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
rpm -qf /etc/*-release
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.