I was discussing with my friend on how the commands are parsed in the shell, and he told me that bash searches the command in following order
- List of aliases
- List of shell keywords
- List of user defined functions
- List of shell built in functions
- List of directories specified in the PATH variable , from left to right.
I know aliases can be found by issuing the alias
command. PATH variable contents can be found using echo $PATH
command.
Can you please tell me which commands do I need to use ?
- To list all shell keywords
- To list all user defined functions
- To list of shell built in functions
type somecmd
ortype -a somecmd
to see which of the above categories it fits into. – Wildcard Apr 03 '16 at 06:28