打印当前计算机和操作系统的名称、版本及其他细节.

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

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

1
2
3
4
5
6
7
8
9
10
11
$ 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 查看到的帮助信息如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
**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 ↩︎