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.

Syntax:

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
Linux

This command prints the kernel name of the operating system.

advertisement
advertisement

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
x86_64

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
x86_64

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

advertisement

Example 5: Printing kernel name

$ uname -s
Linux

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

Example 6: Printing network host name

advertisement
$ uname -n
ubuntu

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
3.8.0-19-generic

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.

advertisement
advertisement
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.