Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

3 Answers 3

up vote 10 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

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.