> 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/manpath.1.md).

# manpath.1

`manpath` — 显示手册页搜索路径

## 名称

`manpath`

## 概要

`manpath [-Ldq]`

## 描述

`manpath` 实用程序从用户的 `PATH` 和本地配置文件确定用户的手册搜索路径。结果输出到标准输出。

**`-L`** 输出手册区域列表而非手册路径。

**`-d`** 打印额外的调试信息。

**`-q`** 抑制警告消息。

## 实现说明

`manpath` 实用程序从两个来源构造手册路径：

1. 从用户 `PATH` 的每个组成部分中查找以下第一个匹配项：
   * **pathname/man**
   * **pathname/MAN**
   * 如果 pathname 以 /bin 结尾：**pathname/../share/man** 和 **pathname/../man**
2. “文件” 章节中列出的配置文件里的 `MANPATH` 条目。

然后将这些位置的信息连接在一起。

如果设置了 `-L` 标志，`manpath` 实用程序将搜索 “文件” 章节中列出的配置文件中的 `MANLOCALE` 条目。

## 环境变量

以下环境变量影响 `manpath` 的执行：

**`MANLOCALES`** 如果与 `-L` 标志一起设置，使实用程序显示警告和该值，覆盖系统上找到的任何其他配置。

**`MANPATH`** 如果设置，使实用程序显示警告和该值，覆盖系统上找到的任何其他配置。

**`PATH`** 按 “实现说明” 中所述影响手册路径。

## 文件

**/etc/man.conf** 系统配置文件。

**/usr/local/etc/man.d/\*.conf** 本地配置文件。

## 参见

[apropos(1)](/man/man1/apropos.1.md), [man(1)](/man/man1/man.1.md), [whatis(1)](https://github.com/FreeBSD-Ask/freebsd-man-sc/blob/main/man1/whatis.1.md), man.conf(5)


---

# 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/manpath.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.
