- Unix Commands Reference
- Unix Commands - Home
uname command in Linux with Examples
Name
uname - prints the name, version and other details about the current machine and the operating system.
Synopsis
uname [OPTION]...
Options
-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 (non-portable) -i, --hardware-platform print the hardware platform (non-portable) -o, --operating-system print the operating system --help display this help and exit --version output version information and exit
Description
The uname is a command line tool most commonly used to determine the processor architecture, the system hostname and the version of the kernel running on the system.
Examples
1. When we run uname
command without any options, it just prints the core operating system name. We can also use -s
option to get the same output, it prints the kernel name of the system.
$ uname Linux $ uname -s Linux
2. We can use -a
option to display all the information in this order. We can also use multiple options, output would be displayed for the selected options in the following order.
- Kernel name
- Nodename/hostname
- Kernel release
- Kernel version
- Machine
- Processor
- Hardware platform
- Operating System
$ uname -a Linux erpnext 4.15.0-142-generic #146~16.04.1-Ubuntu SMP Tue Apr 13 09:27:15 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Displayed output in the above example shows the following items:
- Kernel name: Linux
- Nodename/hostname: erpnext
- Kernel release: 4.15.0-142-generic
- Kernel version: #146~16.04.1-Ubuntu SMP Tue Apr 13 09:27:15 UTC 2021
- Machine: x86_64
- Processor: x86_64
- Hardware platform: x86_64
- Operating System: GNU/Linux
3. Alternatively, we can use the uname
command with option -n
to check the Hostname or Nodename of your machine.
$ uname -n erpnext
4. We can use option -o
option to check the Operating System (or distribution).
$ uname -o GNU/Linux
5. We can use -m
option to display the with uname, it will print the machine hardware name.
$ uname -m x86_64
The output x86_64 is indicating that your system is 64 bit operating system, If uname -m return i686, it means your kernel is a 32 bit kernel.
6. To check the Kernel release version we use -r
option.
$ uname -r 4.15.0-142-generic
7. To display the architecture of the processor we can use -p
option.
$ uname -p x86_64