5

What command should I run in order to find out what distro a Linux server is running?

1

7 Answers 7

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
4
  • 3
    LSB toolset seems to always be available in modern distributions, but rarely installed by default...
    – freiheit
    Aug 23, 2009 at 15:25
  • 3
    @freiheit - I think that says all you need to know about LSB really :-)
    – Zanchey
    Aug 24, 2009 at 4:12
  • the command isn't present on all distros
    – crk
    Dec 17, 2023 at 20:14
  • @crk The command is likely available on all major distros but, as commented on earlier, may not be installed by default for a given distribution under common package selections.
    – doneal24
    Dec 25, 2023 at 20:13
3

I answered a similar question on SuperUser.

For most of the popular distributions then,

cat /etc/*{release,version}
2

For distribution name...

cat /etc/issue

For platform...

uname -a
3
  • 1
    /etc/issue is commonly replaced with a banner about authorized access as best practice in a lot of security guides, and common practice in many organizations.
    – jtimberman
    Aug 23, 2009 at 21:52
  • 1
    yea i overwrite my /etc/issue with ascii art.
    – Roy Rico
    Sep 25, 2009 at 21:09
  • haha, excellent :) Oct 22, 2009 at 17:46
2

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.

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

0

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

0
cat /etc/system-release

for more detailed output

cat /etc/os-release
2
  • /etc/system-release is not found on Linux Mint
    – Davidw
    Dec 24, 2023 at 18:23
  • For OEL 8, these files are provided by the oraclelinux-release package, which is not a required package. Other REL-type systems likely have similarly-named packages that are also not required.
    – doneal24
    Dec 25, 2023 at 20:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .