Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have set some aliases in my .bashrc file and for some reason one of them does not behave as expected.

Since I don't remember the exact command assigned to that alias, I would like to see the command to find out what's wrong.

Except the obvious opening the .bashrc file to see it, is there a command that just echos the command assigned to that alias?

share|improve this question
up vote 17 down vote accepted

Instead of using grep, you can just type alias aliasname to see what an alias is set to.

For example, alias ls will return ls='ls --color=auto'.

Also take a look at the type and whence commands, which return more detailed information about utilities, including executable files in your path, shell built-ins, aliases, and shell functions.

share|improve this answer
Excellent :) I missed where TS said to know the alias name :) +1 – Rinzwind Feb 13 '13 at 14:24

It is as simple as typing


on command line. This will list ALL aliases so if you know specifics you can grep that like so ..

alias|grep rm 

to find commands that use rm where you can substitute rm for anything alias would show you to find that specific alias.

share|improve this answer
which rm

may be the most useful. Normally, it just shows the full path of executable as found in your $PATH. If there are multiple executables of that name, it shows the first one found (the one that would be executed). If there is an alias, it shows the alias in addition to the path.

whereis rm

can also help figure out things like this. While which shows the first instance found in $PATH, whereis shows them all.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.