Sometimes when you log in to the server, you don't know the distribution of Linux, and you need to query it.
Several ways to view linux version information:
- uname -a
- cat /proc/version
- cat /etc/issue
- lsb_release -a
1. Log in to the server and execute lsb_release -a to list all version information, for example: ( Linux Standards Base )
-
sunxt@linux-ubai:/home/public> lsb_release -a LSB Version: n/a Distributor ID: SUSE LINUX Description: openSUSE 11.4 (i586) Release: 11.4 Codename: Celadon
This command works on all linux, including Redhat, SuSE, Debian and other distributions.
- Log in to linux and execute cat /proc/version , for example as follows
sunxt@linux-ubai:/home/public> cat /proc/version Linux version 2.6.37.1-1.2-default (geeko@buildhost) (gcc version 4.5.1 20101208 [gcc-4_5-branch revision 167585] (SUSE Linux) ) #1 SMP 2011-02-21 10:34:10 +0100
xin@xin-desktop:~$ cat /proc/version Linux version 2.6.32-41-generic (buildd@palmer) (gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1) ) #88-Ubuntu SMP Thu Mar 29 13:08:43 UTC 2012
- Log in to linux and execute cat /etc/issue , for example as follows
sunxt@linux-ubai:/home/public> cat /etc/issue Welcome to openSUSE 11.4 "Celadon" - Kernel \r (\l).
4. uname -a
unxt@linux-ubai:/home/public> uname -a Linux linux-ubai 2.6.37.1-1.2-default #1 SMP 2011-02-21 10:34:10 +0100 i686 i686 i386 GNU/Linux