52

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
Leo Kuttoor
  • 583
  • 1
  • 4
  • 7
  • Possible duplicate of [List all aliases available in fish/bash shell](https://stackoverflow.com/questions/39942004/list-all-aliases-available-in-fish-bash-shell) – Ruslan Osmanov Sep 06 '17 at 12:58

3 Answers3

84

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:

command

alias

This command will list all aliases currently set for you shell account.

suhail areekkan
  • 1,646
  • 1
  • 13
  • 16
11

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'
Yong Li
  • 607
  • 3
  • 15
2

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
Daniel
  • 61
  • 10