Files
tldr/pages.zh/common/alias.md
2024-06-23 17:54:14 +02:00

30 lines
640 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# alias
> 创建别名——用给定的字符串指代特定的命令。
> 别名只会在当前的 shell 会话中生效,除非它们在 shell 的配置文件中被定义,例如`~/.bashrc`。
> 更多信息:<https://tldp.org/LDP/abs/html/aliases.html>.
- 列出所有别名:
`alias`
- 创建一个通用的别名:
`alias {{别名}}="{{命令}}"`
- 通过给定的别名查看它所指代的命令:
`alias {{别名}}`
- 移除一个别名:
`unalias {{别名}}`
-`rm` 转换为交互式命令:
`alias {{rm}}="{{rm --interactive}}"`
- 创建别名 `la` 来指代 `ls --all`
`alias {{la}}="{{ls --all}}"`