> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/man/man1/uname.1.md).

# uname.1

`uname` — 显示系统信息

## 名称

`uname` — 显示系统信息

## 概要

`uname [-abiKmnoprsUv]`

## 描述

`uname` 命令将操作系统实现的名称写入标准输出。指定选项时，表示一个或多个系统特征的字符串会被写入标准输出。

可用选项如下：

**`-a`** 表现为如同指定了 `-m`、`-n`、`-r`、`-s` 和 `-v` 选项。

**`-b`** 将内核链接器生成的 build-id 写入标准输出。

**`-i`** 将内核标识写入标准输出。

**`-K`** 写入内核的 FreeBSD 版本。

**`-m`** 将当前硬件平台的类型写入标准输出。（[make(1)](/man/man1/make.1.md) 用它设置 `MACHINE` 变量。）

**`-n`** 将系统名称写入标准输出。

**`-o`** 这是 `-s` 选项的同义词，用于与其他系统兼容。

**`-p`** 将机器处理器架构的类型写入标准输出。（[make(1)](/man/man1/make.1.md) 用它设置 `MACHINE_ARCH` 变量。）

**`-r`** 将内核的当前发布级别写入标准输出。freebsd-version(1) 可用于打印用户空间的发布级别。

**`-s`** 将操作系统实现的名称写入标准输出。

**`-U`** 写入用户环境的 FreeBSD 版本。

**`-v`** 将此操作系统发布的版本级别写入标准输出。

如果指定了 `-a` 标志，或指定了多个标志，所有输出写在单行上，以空格分隔。

`-K` 和 `-U` 标志旨在用于精细区分增量 FreeBSD 开发和用户可见的变更。注意，同时指定这两个选项时，无论顺序如何，内核版本会先打印，随后是用户环境版本。

## 环境变量

由字符串 `UNAME_` 后跟 `uname` 实用程序的任意标志（`-a` 除外）组成的环境变量，允许将相应数据设置为环境变量的内容。更多信息参见 uname(3)。

## 退出状态

`uname` 实用程序成功时以 0 退出，发生错误时以 >0 退出。

## 实例

硬件平台（`-m`）可能与机器的处理器架构（`-p`）不同，例如在 64 位 PowerPC 上，`-m` 会返回 `powerpc`，而 `-p` 会返回 `powerpc64`。

## 参见

freebsd-version(1), feature\_present(3), getosreldate(3), sysctl(3), uname(3), [sysctl(8)](/man/man8/sysctl.8.md)

## 标准

`uname` 命令预期遵循 IEEE Std 1003.2 ("POSIX.2") 规范。

## 历史

`uname` 命令首次出现于 PWB UNIX 1.0，但 4.4BSD 是首个包含 `uname` 命令的 Berkeley 发行版。

`-K` 和 `-U` 扩展标志首次出现于 FreeBSD 10.0。`-b` 扩展标志首次出现于 FreeBSD 13.0。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/man/man1/uname.1.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
