# unalias

删除由alias设置的别名

## 概要

```
unalias [-a] name [name ...]
```

## 主要用途

* 删除一个或多个别名。
* 删除全部已定义的别名。

## 选项

```
-a：删除全部已定义的别名。
```

## 参数

name：指定要删除的一个或多个已定义的别名。

### 返回值

unalias返回true除非您要删除的别名未定义。

## 例子

```
# 删除全部已定义的别名
unalias -a

# 删除已定义的别名（假设当前环境存在以下别名）
unalias vi
unalias ls grep
```

## 错误用法

* 要删除的别名未定义。
* 不使用-a选项时没有传递name参数。

### 注意

1. **执行脚本时请注意：**

> 使用`source`命令执行的bash脚本如果执行了`alias`或`unalias`命令，那么有可能会对终端环境的别名设置产生影响；终端环境的别名设置也可能改变运行结果；
>
> 通过`sh`方式调用的bash脚本或直接运行当前用户有执行权限的脚本不受终端环境的别名影响。

1. 查看及设置别名，请查看`alias`命令。
2. 该命令是bash内建命令，相关的帮助信息请查看`help`命令。


---

# Agent Instructions: 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:

```
GET https://hezhiqiang.gitbook.io/linux/ming-ling/unalias.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
