> For the complete documentation index, see [llms.txt](https://hezhiqiang.gitbook.io/linux/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hezhiqiang.gitbook.io/linux/ming-ling/dpkg-divert.md).

# dpkg-divert

Debian Linux中创建并管理一个转向列表

## 补充说明

**dpkg-divert命令** 是Debian Linux中创建并管理一个转向（diversion）列表，其使得安装文件的默认位置失效的工具。

### 语法

```
dpkg-divert(选项)(参数)
```

### 选项

```
--add：添加一个转移文件；
--remove：删除一个转移文件；
--list：列出匹配的转移；
--truename：对应转移文件真实文件名；
--quidet：安静模式。
```

### 参数

文件：指定转移文件名。

### 实例

指定软件包wibble安装时，写入`/usr/bin/example.foo`，而不是`/usr/bin/example`：

```
dpkg-divert --package wibble --divert /usr/bin/example.foo --rename /usr/bin/example
```

指定软件包wibble安装时，删除对`/usr/bin/example`的转移修改：

```
dpkg-divert --package wibble --rename --remove /usr/bin/example
```

删除对`/usr/bin/example`的转移修改：

```
dpkg-divert --rename --remove /usr/bin/example
```

添加一个软件包安装时，写入`/usr/bin/example.foo`，而不是`/usr/bin/example`的修改：

```
dpkg-divert --divert /usr/bin/example.foo --rename /usr/bin/example
```


---

# 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://hezhiqiang.gitbook.io/linux/ming-ling/dpkg-divert.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.
