5

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.

Nick Bolton
  • 5,016
  • 12
  • 51
  • 62
  • Possible duplicate of [Determining type of Linux machine](https://serverfault.com/questions/55834/determining-type-of-linux-machine) – Jenny D Apr 14 '17 at 10:16

6 Answers6

14

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
Zanchey
  • 3,041
  • 20
  • 28
3

I answered a similar question on SuperUser.

For most of the popular distributions then,

cat /etc/*{release,version}
jtimberman
  • 7,511
  • 2
  • 33
  • 42
2

For distribution name...

cat /etc/issue

For platform...

uname -a
Nick Bolton
  • 5,016
  • 12
  • 51
  • 62
1

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.

freiheit
  • 14,334
  • 1
  • 46
  • 69
0

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 :-)

Anonymous
  • 1,540
  • 1
  • 14
  • 18
0

You can also run nmap -A to let it guess the OS and version installed on a remote host

dmityugov
  • 756
  • 4
  • 5