Unit 2 Internal and External Linux Commands
Unit 2 Internal and External Linux Commands
Linux commands are essential tools for system administrators and developers alike.
These commands can be categorized into two main types: internal and external
commands. Internal commands are built into the shell itself, meaning they do not
require an external executable file to run. External commands, on the other hand, are
executable files stored in the file system.
Understanding the difference between these two types of commands is crucial for
efficient system management and troubleshooting. Internal commands are typically
faster because they are executed directly by the shell, while external commands might
involve more overhead as the shell needs to locate and execute the corresponding file.
To determine whether a command is internal or external, you can use the type
command. The type command provides information about how a command name is
interpreted. Here is how you can use it:
type command_name
For example:
$ type cd
$ type ls
Internal Command Example: cd: The cd command is used to change the current
directory. It is an internal command because it is built into the shell.
$ cd /home/user
In this example, the cd command changes the current directory to /home/user. Since it
is an internal command, it is executed quickly by the shell without the need to search
for an external executable.
External Command Example: ls: The ls command lists the contents of a directory. It
is an external command because it is an executable file located in the file system.
$ ls -l /home/user
In this example, the ls command lists the contents of the /home/user directory in long
format. The shell locates the ls executable file in the directories listed in the PATH
environment variable and runs it.
Command Description