how to get OS name from command line
Hi
Which is the best way (which will work on any os) to get OS name and version from command line ? Thank you! |
When you say "any" do you mean "any", or "any *nix"?
|
The following command is probably what you want:
uname -a |
Quote:
For example "uname -a" on my system does not return "OS name and version" but only Linux Kernel. |
The manual for uname (type "man uname" on the command line) should help.
|
Quote:
Thanks , but there is no option on uname which can correctly show OS . For example on a server with centos 4 , is simply shows "GNU/Linux" |
Quote:
|
cat /proc/version
|
Quote:
edit: also obviously won't work in windows which completely lacks /proc which is in *nixes. |
Most versions of Linux put a version file in the /etc directory with the version number of the distro..
the downside is they don't all give the file the same name to make it easy.. for example Code:
it-etch:$ cat /etc/debian_version |
I have rather quickly come to appreciate infobash, but I'm not sure that it works on anything except Debian.
Code:
debian64:~$ infobash -v3 |
OP, you never clarified -- "any" or "any *nix"?
Granted we know that you probably mean "any *nix", but it would be nice to be sure. I don't think it's easily done -- even the /etc/debian-version on my SimplyMEPIS boxen (3.3.2 & 6.0) say nothing about MEPIS, just "testing/unstable" & "testing". And then: Code:
$ cat /proc/version |
Several distros maintain a text file containing the info. I asked a question on here a while ago to try and gather a list, you could search for it, contained information on distro information paths.
For example arch has /etc/arch-release however as of the latest release, it doesn't contain anything. Which is a pig since i had a system information script that would poll various files to state the distro :( |
Quote:
Quote:
Similarly, on CentOS I found file /etc/redhat-release. It seems that Quote:
Quote:
|
I smell the possibility of a good HowTo here.
Where should we start? |
All times are GMT -5. The time now is 08:41 AM. |