← 返回命令列表

Linux command

unalias 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Remove a specific alias

unalias [name]

Remove all aliases

unalias -a

Remove multiple aliases

unalias [name1] [name2]

说明

unalias is a shell builtin that removes previously defined command aliases. It can remove specific aliases by name or all aliases at once with the -a flag. The removal only affects the current shell session. Aliases defined in shell startup files like ~/.bashrc or ~/.zshrc will be restored when a new shell is started. This makes unalias useful for temporarily bypassing an alias to test the underlying command's behavior or for debugging shell configuration issues. Returns 0 on success, or a value greater than 0 if a specified alias name does not exist.

参数

-a
Remove all alias definitions from the current shell execution environment.

FAQ

What is the unalias command used for?

unalias is a shell builtin that removes previously defined command aliases. It can remove specific aliases by name or all aliases at once with the -a flag. The removal only affects the current shell session. Aliases defined in shell startup files like ~/.bashrc or ~/.zshrc will be restored when a new shell is started. This makes unalias useful for temporarily bypassing an alias to test the underlying command's behavior or for debugging shell configuration issues. Returns 0 on success, or a value greater than 0 if a specified alias name does not exist.

How do I run a basic unalias example?

Run `unalias [name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -a do in unalias?

Remove all alias definitions from the current shell execution environment.