Tag Info

New answers tagged

4

where is a shell builtin command in csh where where where is a shell built-in the builtin is also available in zsh.


6

The only shells I know which has a builtin command called where is the tcsh and zsh. In the manual page of that shell (man tcsh / man zshbuiltins), you can find the definition: where command (+) Reports all known instances of command, including aliases, builtins and executables in path. Therefore it is the tcsh-equivalent of the ...


2

The linux command is called which. If you are used to in c-shells this might be a builtin. Bash builtins are documented through the bash builtin help. From Wikipedia:tcsh The built-in where command. Works like the which command but shows all locations of the target command in the directories specified in $PATH rather than only the one that will be used. ...


2

Since there are several good answers here about using type to find out if a command such as cat is a builtin or an external program. I am going to take a more general approach. There are some commands that must be builtins because they affect the current shell. Three classic examples are cd, exec, and exit. There are some commands that must not be builtins ...


2

Others have already answered about cat, I would just like to explain the issue with echo. If you use type's -a option (list all matches), you will see that echo is both a shell builtin and an external program: $ type -a echo echo is a shell builtin echo is /bin/echo The two are completely independent of one another. type with no options will simply return ...


42

cat is hashed (/bin/cat) is just like cat is /bin/cat (that is, it's an external program). The difference is that you already ran cat in this session, so bash has already looked it up in $PATH and stored the resulting location in a hash table so it doesn't have to look it up again in this session. To see all the commands that have been hashed in your ...


5

Another way to check list of shell builtin : Using compgen which is shell builtin itself! Following command lists all shell builtin commands: compgen -b You can check for cat, echo by greping like:- $ compgen -b | grep echo echo $ compgen -b | grep cat $ You can see compgen -b | grep cat returns with no output, means cat is not shell builtin. Visit ...


4

You can also use the command whereis that is more efficient because it shows where the command is on the machine like also the manual pages library, etc..


58

type tells you what the shell would use. For example: $ type echo echo is a shell builtin $ type /bin/echo /bin/echo is /bin/echo That means that if, at the bash prompt, you type echo, you will get the built-in. If you specify the path, as in /bin/echo, you will get the external command. which, by contrast is an external program that has no special ...



Top 50 recent answers are included