What command should I run in order to find out what distro a Linux server is running?
7 Answers
On most modern distributions, you can query the Linux Standard Base system with
lsb_release -d
Sample output:
Description: Debian GNU/Linux 5.0.2 (lenny)
Description: Ubuntu 9.04
- 3,051
I answered a similar question on SuperUser.
For most of the popular distributions then,
cat /etc/*{release,version}
- 7,665
The most reliable for figuring out which linux distribution:
ls -ld /etc/*release* /etc/*version*
Then cat whatever files look interesting from that.
But you probably (as mentioned in another comment already) always want to run uname -a first, in case it isn't even a linux distribution.
- 14,844
There is a routine in VBoxSysInfo.sh, that is part of VirtualBox that can be a good starting point.
However, I'd rather ask the sysadmin about this. Apart from the distribution, particular servers can have specific settings and it is frustrating to discover those right after breaking them (not to mention pissing off the sysadmin, that'll became hostile to you for being a smartass and breaking his server). I tend to treat all sysadmins as friends/teammates, there is plenty of other people to fight with: users, management etc :-)
- 1,580
You can also run nmap -A to let it guess the OS and version installed on a remote host
- 756