Linux uname command

By | 13/09/2012

Want to know some details about your Linux system? Well, there is a command ‘uname’ that can tell you a lot about your Linux system. In this article, lets discuss Linux uname command through some examples.

Linux uname command

Before jumping on to examples, lets quickly take a look at its syntax. From the man page of this command :

NAME
uname – print system information

SYNOPSIS
uname [OPTION]…

Note that the square brackets [] in the syntax above mean that OPTION is not always required. This command should work by just writing ‘uname’ on command prompt.

Uname command examples

1. Print the kernel name

If this command is run without any option or with the option -s, then the kernel name is produced in the output.

An example :

$ uname 
Linux 

$ uname -s 
Linux

The command was run with the option -s and without any option and as we can see in the output, the kernel name was produced in the output.

2. Print the network node name

If this command is run with the option -n, then it prints your system’s network node name.

An example :

$ uname -n 
linuxuser-laptop

The network node name was produced in the output above.

3. Print the kernel release

If this command is run with the option -r, then it produces the release information of the kernel.

An example :

$ uname -r 
2.6.32-21-generic

The release information was produced in the output above.

4. Print the kernel version

If this command is run with option -v, then it produces the kernel version.

An example :

$ uname -v 
#33-Ubuntu SMP Fri Apr 18 08:09:38 UTC 2011

The kernel version was produced in the output above.

5. Print the machine hardware name

If this command is run with option -m, then it produces the hardware name.

An example :

$ uname -m 
x86_64

Hardware details were produced in output above.

6. Print the operating system

If this command is run with option -o, then it produces the OS name.

An example :

$ uname -o 
GNU/Linux

OS name was produced in the output above.

Apart from the options discussed above, there are two other options -p and -i that are used to print the processor type and hardware platform. On my system both of these returned ‘unknown’. Some details regarding this can be found on the Wikipedia.

Leave a Reply

Your email address will not be published. Required fields are marked *