TrumanWong

uname

Print system information.

Summary

uname [OPTION]...

The main purpose

  • Print machine and operating system information.
  • When no option is given, the -s option is enabled by default.
  • If multiple options or the -a option are given, the output information is sorted by the following fields: kernel name host name kernel release kernel version Machine name Processor Hardware platform Operating system.

Options

-a, --all Print all information in order, if -p and -i information is unknown, then omit.
-s, --kernel-name Print kernel name.
-n, --nodename Print network node host name.
-r, --kernel-release Print kernel release.
-v, --kernel-version Print kernel version.
-m, --machine Print machine name.
-p, --processor Print processor name.
-i, --hardware-platform Print the hardware platform name.
-o, --operating-system Print operating system name.
--help Display help information and exit.
--version Display version information and exit.

return value

Returning 0 indicates success, returning a non-zero value indicates failure.

example

# When using the uname command alone, it is equivalent to uname -s
[root@localhost ~]# uname
Linux
# View all information
[root@localhost ~]# uname -a
Linux localhost 2.6.18-348.6.1.el5 #1 SMP Tue May 21 15:34:22 EDT 2013 i686 i686 i386 GNU/Linux
# List information separately
[root@localhost ~]# uname -m
i686

[root@localhost ~]# uname -n
localhost

[root@localhost ~]# uname -r
2.6.18-4-686

[root@localhost ~]# uname -s
Linux

[root@localhost ~]# uname -v
#1 SMP Tue May 21 15:34:22 EDT 2013

[root@localhost ~]# uname -p
i686

[root@localhost ~]# uname -i
i386

[root@localhost ~]# uname -o
GNU/Linux

Notice

  1. This command is a command in the GNU coreutils package. For related help information, please see man -s 1 uname, info coreutils 'uname invocation'.