How do I find out the distro of a server?

I always wonder this, every time someone gives me access to their server, I always want to find out what distro it is. I figured it'd be more fun to actually type a command rather than asking the admin.


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

I answered a similar question on SuperUser.

For most of the popular distributions then,

cat /etc/*{release,version}

For distribution name...

cat /etc/issue

For platform...

uname -a

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.