本文 首发于 🌱 煎茶转载 请注明 来源

unameunix name的简写)是一个Unix类Unix操作系统上的程序,可以打印当前计算机和操作系统的名称、版本及其他细节1

不加参数时默认行为等价于 uname -s,使用 -a 可打印所有信息,其内容对应如下:

$ uname
Linux hci 5.4.73-1-pve #1 SMP PVE 5.4.73-1 (Mon, 16 Nov 2020 10:52:16 +0100) x86_64 GNU/Linux
↑↑↑↑↑ ↑↑↑ ↑↑↑↑↑↑↑↑↑↑↑↑ ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ ↑↑↑↑↑↑ ↑↑↑↑↑↑↑↑↑
  1    2        3                                4                              5       6

1 -> kernal name
2 -> node name
3 -> kernal release
4 -> kernal version
5 -> machine hardware name
6 -> operating system

在 unix-like 系统(如 Debian) 上使用 man uname 查看到的帮助信息如下:

**NAME
       uname - print system information

SYNOPSIS
       uname [OPTION]...

DESCRIPTION
       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 (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

AUTHOR
       Written by David MacKenzie.

REPORTING BUGS
       GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
       Report uname translation bugs to <https://translationproject.org/team/>

COPYRIGHT
       Copyright  ©  2018  Free  Software Foundation, Inc.  License GPLv3+: GNU GPL version 3 or later
       <https://gnu.org/licenses/gpl.html>.
       This is free software: you are free to change and redistribute it.  There is  NO  WARRANTY,  to
       the extent permitted by law.

SEE ALSO
       arch(1), uname(2)

       Full documentation at: <https://www.gnu.org/software/coreutils/uname>
       or available locally via: info '(coreutils) uname invocation'**

参考文献


  1. uname By Wikipedia ↩︎