By default, uname prints the name of the kernel—Linux. You can view the kernel version number of your current system by using the uname -r command. You can also enter uname -i to view the hardware platform. To print all information, enter theuname -acommand. Without any flags, the uname command will display the operating system that your are using. Here are some useful options:
Option | Description |
---|---|
-a | Displays all information |
-s | Displays the kernel name |
-n | Displays the network node (a.k.a. the host name) |
-r | Displays the release version of the kernel |
-v | Displays the version (date) of the kernel |
-m | Displays the machine hardware name (often the same as -p) |
-p | Displays the processor type (often the same as -m) |
-o | Displays the operating system |
If you encunter below error while running the uname command:
uname: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
OS X | brew install coreutils |
Debian | apt-get install coreutils |
Ubuntu | apt-get install coreutils |
Alpine | apk add coreutils |
Arch Linux | pacman -S coreutils |
Kali Linux | apt-get install coreutils |
CentOS | yum install coreutils |
Fedora | dnf install coreutils |
Raspbian | apt-get install coreutils |
uname Command Examples
The uname command helps to check Linux version & system information like using uname command you can check Operating System details, Kernel Version, Operating System architecture whether it’s 32 Bit or 64 Bit and many more. So let’s go ahead and have a look at uname Linux commands with examples.
1. Simply to check which operating system you are currently using you can just use the below command.
# uname # Check the Operating System Linux
2. You can also use the uname command with argument -s to check your current operating system name. Refer the below command.
# uname -s Linux
By using uname Linux command you can check Linux version and also get below system information’s i.e. :
- Operating System name
- Hostname of the System
- Kernel Version
- Operating System architecture i.e. 32 Bit or 64 Bit
- Kernel Released & Compiled date & time
3. To get all above details you can use the uname command with argument -a. Refer the command below.
# uname -a # Check all System Information Linux localhost.localdomain 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
4. Use the uname linux command with argument -n to check the Hostname or Network name of your operating system.
# uname -n # Check the Hostname of the System localhost.localdomain
5. To check the Kernel release version just use the uname Linux command with argument -r. Here my Kernel version is 2.6.32-431.el6.x86_64.
# uname -r # Check Kernel Version 2.6.32-431.el6.x86_64
6. You can check the Machine hardware type of your system by using uname Linux command with argument -m. Refer the command below.
# uname -m # Check the Hardware type x86_64
7. To check processor type use below command. Here we are using the x86_64 processor type.
# uname -p # Check the Processor Type x86_64
8. To check the Hardware platform use the uname Linux command with argument -i.
# uname -i # Check the Hardware Platform x86_64
9. To check the current operating system use the uname Linux command with argument -o. As you can see the output below we are currently using GNU/Linux Operating System
# uname -o # Check the Operating System GNU/Linux
9. To check Kernel Compiled version with date & time use uname command with argument -v. as you can see below the output of this command is #1 SMP Fri Nov 22 03:15:09 UTC 2013. Here the Kernel is compiled first time hence it’s showing #1.
# uname -v # Check Kernel compiled version #1 SMP Fri Nov 22 03:15:09 UTC 2013
For more information’s on uname Linux command with all available arguments you can access the Help page by using the below command.
# uname --help # Access the Help Page Usage: uname [OPTION]... Print certain system information. With no OPTION, same as -s. -a, --all print all information, in the following order, except omit -p and -i if unknown: -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 or "unknown" -i, --hardware-platform print the hardware platform or "unknown" -o, --operating-system print the operating system --help display this help and exit --version output version information and exit
Check the installed uname package version just use the below command. The output will show you about The Author Name, The package release date, License details, Official website of this package and many more.
# uname --version # Check Package Version uname (GNU coreutils) 8.4 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by David MacKenzie.