uname Command in Linux with Examples

The uname command in Linux displays system information, including the operating system name, kernel version, and more. It is useful for scripting, troubleshooting, and identifying the system’s characteristics.


uname [OPTION]

Options Description:

  • -a, –all: Print all information in the order.
  • -s, –kernel-name: Print the kernel name.
  • -n, –nodename: Print the network node hostname.
  • -r, –kernel-release: Print the kernel release.
  • -v, –kernel-version: Print the kernel version.
  • -m, –machine: Print the machine hardware name.
  • -p, –processor: Print the processor type.
  • -i, –hardware-platform: Print the hardware platform.
  • -o, –operating-system: Print the operating system.

uname Command Examples

Here are various examples of using the uname command to retrieve system information in Linux.

Example 1: Printing general system information

$ uname

This command prints the kernel name of the operating system.


Example 2: Printing all system information

$ uname -a
Linux ubuntu 3.8.0-19-generic #29-Ubuntu SMP Wed Apr 17 18:16:28 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

The -a option prints all system information, including the kernel name, network host name, kernel release, kernel version, machine hardware name, processor type, hardware platform, and operating system.

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

Example 3: Printing machine hardware name

$ uname -m

The -m option displays the machine hardware name, which in this case is “x86_64,” indicating a 64-bit architecture.

Example 4: Printing hardware platform information

$ uname -i

Similar to -m, the -i option shows the hardware platform information, also displaying “x86_64”.


Example 5: Printing kernel name

$ uname -s

The -s option prints the kernel name, which is “Linux” in this case.

Example 6: Printing network host name

$ uname -n

The -n option displays the network host name, revealing the system’s name within the network, which is “ubuntu” in this case.

Example 7: Printing kernel release information

$ uname -r

This command uses the -r option to print the kernel release information, which is “3.8.0-19-generic” in this case.

Example 8: Printing kernel version information

$ uname -v
#29-Ubuntu SMP Wed Apr 17 18:16:28 UTC 2013

The -v option prints the kernel version information, providing details such as the build or revision number and timestamp.

Example 9: Using multiple options together

$ uname -prnv
ubuntu 3.8.0-19-generic #29-Ubuntu SMP Wed Apr 17 18:16:28 UTC 2013 x86_64

This command combines multiple options (-p, -r, -n, -v) to display information about the system’s name, kernel release, network host name, and kernel version, respectively.

Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.

If you wish to look at all Linux commands and their usage examples, go to Linux Commands Tutorial.

Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.