例如,我想以详细的形式 ls -l
而不是通常的ls
格式列出当前工作目录中的所有文件,而不必每次都输入选项。任何帮助,将不胜感激。谢谢你。
问问题
53 次
1 回答
1
你所说的“宏”,在 bash 中被定义为“别名”。从man bash
(在第 3744 行的某处):
alias [-p] [name[=value] ...] Alias with no arguments or with the -p option prints the list of aliases in the form alias name=value on standard output. When arguments are supplied, an alias is defined for each name whose value is given. A trailing space in value causes the next word to be checked for alias substitution when the alias is expanded. For each name in the argument list for which no value is sup‐ plied, the name and value of the alias is printed. Alias returns true unless a name is given for which no alias has been defined.
您可以在文件中创建别名,~/.bash_aliases
如下所示:
alias ls="ls -l"
此外,在 Ubuntu 12.04 中已经有一个ls
in~/.bashrc
文件的别名,您可以根据需要进行更新。要找到它,请搜索此行:
alias ls="ls --color=auto"
并将其更改为:
alias ls="ls --color=auto -l"
于 2013-10-31T16:01:53.043 回答