tisdag 10 februari 2015

Linuux - Command: Show Linux Version and dist


by on July 1, 2009 · 14 comments· LAST UPDATED December 29, 2013
What command I need to type to display Linux kernel version and other information such as Linux distribution name? How do I check Linux kernel version number?

You need to use the following two commands:[a] uname - Print kernel and system information.
Tutorial details
DifficultyEasy (rss)
Root privilegesNo
RequirementsNone
Estimated completion time1m

[b] lsb_release - Print distribution-specific information.[c] /proc/version file - Print running kernel information.

How to check linux kernel version number?

Open a shell prompt (or a terminal) and type the following command to see your current Linux kernel version:
$ uname -r
Sample outputs:
2.6.32-23-generic-pae
Or type the following command:
$ uname -mrs
Sample outputs:
Linux 2.6.32-23-generic-pae i686
To print all information, enter:
$ uname -a
Sample outputs:
Linux vivek-laptop 2.6.32-23-generic-pae #37-Ubuntu SMP Fri Jun 11 09:26:55 UTC 2010 i686 GNU/Linux
Where,
  • 2.6.32-23 - Linux kernel version number
  • pae - pae kernel type indicate that I'm accssing more than 4GB ram using 32 bit kernel.
  • SMP - Kernel that supports multi core and multiple cpus.

/proc/version file

Type the following command to see Linux version info:
$ cat /proc/version
Sample outputs:
Linux version 3.2.0-0.bpo.1-amd64 (Debian 3.2.4-1~bpo60+1) (ben@decadent.org.uk) (gcc version 4.4.5 (Debian 4.4.5-8) ) #1 SMP Sat Feb 11 08:41:32 UTC 2012
The above output identifies the kernel version that is currently running. It includes the contents of /proc/sys/kernel/ostype, /proc/sys/kernel/osrelease, and /proc/sys/kernel/version files. For example:
$ cat /proc/sys/kernel/{ostype,osrelease,version}
Sample outputs:
Linux
3.2.0-0.bpo.1-amd64
#1 SMP Sat Feb 11 08:41:32 UTC 2012

Find Distribution Version

Type the following command:
$ cat /etc/*release
OR
$ lsb_release -a
Sample outputs:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 10.04 LTS
Release: 10.04
Codename: lucid
Here is another output from my Debian based server:
lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 6.0.6 (squeeze)
Release: 6.0.6
Codename: squeeze

Related media

This tutorial is also available in a quick video format:


Video 01: Find The Linux Kernel Version Command Tutorial
Tweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?
{ 14 comments… read them below or add one }
1 vivek July 10, 2013 at 12:12 pm
COluld you please help what explaination it gives regarding version of linux?.
Linux pd13027a.symphonyteleca.com 2.6.32-71.el6.x86_64 #1 SMP Wed Sep 1 01:33:01 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
2 TheLonelyDBA August 14, 2013 at 9:57 pm
also a simple command that will show the release of the Linux you have:
$ cat /etc/issue
output: Red Hat Enterprise Linux Server release x.x
3 ralfaux January 27, 2015 at 2:32 am
How can you be a lonelyDBA when you can provide the perfect answer?
While we’re at it, what should I do with my life? I know, lazy… ;-)
4 R.Muthukumar October 22, 2013 at 7:16 am
Hi,
how to find OS name with service pack in suse linux.. can you please give the command..
Regards
R.Muthukumar
5 Phil November 25, 2013 at 11:46 pm
Not sure what you’re asking here exactly. To get a list of the packages installed you can use the rpm command. rpm -qa to query all packages installed (see man pages on command structure).
6 Sagar Bhuayr February 13, 2014 at 5:55 am
For check OS name simply enter “uname” command & for check packages installed or not we can check with the help of “rpm -qa packagename”.
7 Sriharsha Kalluru August 12, 2014 at 6:30 am
You can get that one from following commands.
To determine it is SuSE:
cat /proc/version
To check SuSE version:
cat /etc/SuSE-release
SUSE LINUX Enterprise Server 9 (i586)
VERSION = 9
8 Mohamed Ali Ahmed(Bile) January 20, 2014 at 11:43 am
thank you guys for this useful information.
9 Thiago April 28, 2014 at 11:01 pm
Thanks very much !!!!
10 suresh sawant April 30, 2014 at 6:18 pm
how to find linux redhat version
for e.p.– redhat 4.4 , redhat 5.4, redhat 5.9
11 Kaniti May 9, 2014 at 9:55 am
cat /etc/*release
12 Girish KG November 26, 2014 at 10:43 am
grep -Eo ‘^[^ ]+’ /etc/issue.net | sed ‘2d’
13 belal k December 18, 2014 at 11:43 pm
If we want to search the contents of all of the files in current directory and display the total number of lines in them that contain the string Linux. Which of the below commands will do that
14 belal k December 18, 2014 at 11:44 pm
cat * | grep Linux | wc -l
cat * | wc -l
grep Linux | wc -l
cat * | head | grep Linux

Inga kommentarer: