How to list all aliases defined in a 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
command
ls in a directory
How to list all aliases defined in a 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
ls in a directory
Are you wondering if you have a UNIX alias already set for a specific command?
You can find it easily by issuing this on the command line:
alias
This command will list all aliases currently set for you shell account.
Just type alias
in terminal?
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 -a
compgen
empowers you to list all your defined aliases, functions and commands.Another option would be alias
command itself.
alias