When I use the type
command to find out if cat
is a shell built-in or an external program I get the output below:
-$ type cat
cat is hashed (/bin/cat)
-$
Does this mean that cat
is an external program which is /bin/cat
?
I got confused, because when I checked the output below for echo
I got to see that it is a built-in
but also a program /bin/echo
-$ type echo
echo is a shell builtin
-$ which echo
/bin/echo
-$
So I could not use the logic that /bin/cat
necessarily means an external program, because echo was /bin/echo
but still a built-in.
So how do I know what cat
is? Built-in or external?
type which
could give you the answer whywhich
won't give you the answer.cat
andls
are/were written by Stallman himself. You'd be surprised how much stuff he wrote. Don't forget he wrote the first versions of the compiler that is today the best compiler in the world that compiles EVERYTHING and most of the core utils. Just sayin'