0

This question already has an answer here:

What differences between two below commands in CentOS7?

$ type cd
cd is a shell builtin

and

$ which  cd
cd is a shell builtin
cd is /usr/bin/cd
cd is /bin/cd

The cd is a shell builtin command, but why which command show another path for cd ? Is the cd command both internal command and external command ?

marked as duplicate by jasonwryan, JdeBP, Anthony Geoghegan, jimmij, Jeff Schaller Oct 22 '18 at 10:21

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.

2

which shows the full path of (shell) commands.
its output is different based on different systems.
type display information about command type on Linux.
(see man page for more info)
we have 4 command types:
Built-in Shell Commands
Shell Functions
Command Alias
excutable Programs

for example:

# type ll  
ll is aliased to `ls -l --color=auto'  
# type cd  
cd is a shell builtin
# type sudo  
sudo is /usr/bin/sudo
  • In my /bin and /usr/bin/ directories, I have cd command. So, i want to know, what differences between cd builtin command and these two? – Reza Harasani Oct 22 '18 at 5:06
  • what is your OS? – BlackCrystal Oct 22 '18 at 5:10
  • Linux CentOS7 – Reza Harasani Oct 22 '18 at 5:14
  • 2
    check this out. askubuntu.com/questions/532788/… – BlackCrystal Oct 22 '18 at 5:15
  • @BlackCrystal - What is the use case for the type command? When is it used and for what purpose? – Motivated Jan 17 at 1:54

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