简体   繁体   English

获取 linux shell 中的所有别名

[英]get all aliases in linux shell

How to list all aliases defined in a shell.如何列出 shell 中定义的所有别名。 Like the command below to list all files/folders in a directory I have defined some alias in ~/.bashrc i want to list all that就像下面列出目录中所有文件/文件夹的命令一样,我在~/.bashrc中定义了一些别名,我想列出所有这些

command命令

ls in a directory

Are you wondering if you have a UNIX alias already set for a specific command? 您是否想知道是否已为特定命令设置了UNIX别名?

You can find it easily by issuing this on the command line: 您可以通过在命令行上发布它来轻松找到它:

command 命令

alias

This command will list all aliases currently set for you shell account. 此命令将列出当前为您的shell帐户设置的所有别名。

Just type alias in terminal? 只需在终端输入alias This should give you all active aliases. 这应该为您提供所有活动别名。

For example: 例如:

$alias
alias ..='cd ..'
alias ...='cd ../..'
alias ga='git add'
alias gc='git commit'
alias gitlg='git log --graph --pretty=format:'\''%Cred%h%Creset -
%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-
commit'
alias gs='git st'
alias ll='ls -l'
alias ls='ls -F --color=auto --show-control-chars'

You can use the compgen command as follows:您可以使用compgen命令,如下所示:

compgen -a
  • compgen empowers you to list all your defined aliases, functions and commands. compgen使您能够列出所有定义的别名、函数和命令。

Another option would be alias command itself.另一种选择是alias命令本身。

alias

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM