Leo Kuttoor
Leo Kuttoor

Reputation: 703

Get all aliases in Linux shell

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 aliases in ~/.bashrc that I want to list.

ls in a directory

Upvotes: 64

Views: 89979

Answers (3)

suhail areekkan
suhail areekkan

Reputation: 1956

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 your shell session.

Upvotes: 111

Daniel
Daniel

Reputation: 71

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

Upvotes: 3

Yong Li
Yong Li

Reputation: 647

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'

Upvotes: 15

Related Questions