Saturday, April 27, 2024
12
rated 0 times [  12] [ 0]  / answers: 1 / hits: 3614  / 2 Years ago, sun, october 9, 2022, 3:44:37

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.


More From » command-line

 Answers
2

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)?


[#33278] Monday, October 10, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
oatglori

Total Points: 313
Total Questions: 102
Total Answers: 111

Location: Guam
Member since Thu, May 18, 2023
1 Year ago
oatglori questions
;