Introduction
As a Linux user chance are you use terminal with shell inside. The shell has 2 types of commands : internal shell commands and external shell commands. depending on whether it's a function inside the shell or an executable somewhere in the file system.
Internal shell commands
These commands are also called built-in commands, they are functions in the shell program (bash, zsh, etc..). When you execute built-in command the shell search it inside it self, and call it if it exist, and run it in the shell process it self.
Internal command are fast to run.
exemple of external shell command : date, touch, tail
External shell commands
These commands are executables files store somewhere il the file system. When you execute them the shell will first search the command inside it self, and if it doesn't exist the shell will search in the file system and run it as a separate process with the arguments and or options.
example of external shell command : cd, pwd, type.
How to know a shell command type ?
To know whether a command is internal or external shell command we can use the command type with argument.
syntax :
type argument
For example :
# to know the type of pwd command
type pwd
Conclusion.
In this post we learn that there is 2 types of shell commands : internal and external shell command. And toknow whether a command is internal or external we use type command.
Sometime we can find other types that are aliases for examples ll is alias of ls -l:
# type of ll command is ls -l
type ll