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

The command which cd prints nothing. Same for whatis cd and whereis cd. How can I find out if cd is an alias, function, or bash built-in? I'm using Ubuntu 12.04.

share|improve this question

marked as duplicate by muru command-line Mar 13 at 17:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 11 down vote accepted

In bash, which is an external utility. It only finds external commands: it does not know about aliases, builtins or functions. The same goes for whatis and whereis.

Forget which and use type instead.

$ type cd
cd is a shell builtin

Builtins don't have a man page of their own (unless they also exist as an external utility, but then you get the documentation of the external utility, which may support different options). They are documented in the bash manual.

See also How to use which on an aliased command? and My which command may be wrong (sometimes)?

share|improve this answer
I like type -a too -- it shows all executables/alias/function -- example type -a [ – glenn jackman Jan 9 '13 at 23:50
type with its various options is definitely more reliable. which shows tremendous variations in power from distro to distro (cf. red hat vs debian). – reasgt Jan 10 '13 at 21:55

man bash will tell you that. Move to the end and then search for BASH BUILTIN COMMANDS. You can read on from there.

share|improve this answer

To list all bash aliases:


To list all defined function names:

typeset -F

To see the list of bash builtins, check the bash manpage.

You can probably hack together a single script to grep through the output of each command above.

share|improve this answer

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