How can I tell what version of Linux I'm using?

  • Often times I will ssh into a new client's box to make changes to their website configuration without knowing much about the server configuration. I have seen a few ways to get information about the system you're using, but are there some standard commands to tell me what version of Unix/Linux I'm on and basic system information (like if it is a 64-bit system or not), and that sort of thing?

    Basically, if you just logged into a box and didn't know anything about it, what things would you check out and what commands would you use to do it?

    `cat /etc/*release*` works on most popular distros

  • Gaumire

    Gaumire Correct answer

    9 years ago

    If I need to know what it is say Linux/Unix , 32/64 bit

    uname -a 
    

    This would give me almost all information that I need,

    If I further need to know what release it is say (Centos 5.4, or 5.5 or 5.6) on a Linux box I would further check the file /etc/issue to see its release info ( or for Debian / Ubuntu /etc/lsb-release )

    Alternative way is to use the lsb_release utility:

    lsb_release -a
    

    Or do a rpm -qa | grep centos-release or redhat-release for RHEL derived systems

    In 2016 it does not seem like `lsb_release` works any longer with modern distros. I tested the command on Amazon Linux AMI release 2016.03 and CentOS Linux 7 and it was not found. It seems like ls `cat /etc/os-release` is the best solution currently with `uname -a` somewhat usable if a bit opaque (e.g. Amazon Linux AMI release 2016.03 vs. Linux ip-x-x-x-x 4.4.11-23.53.amzn1.x86_64 #1 SMP Wed Jun 1 22:22:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux)

    Well Done (y) :)

License under CC-BY-SA with attribution


Content dated before 6/26/2020 9:53 AM