0% found this document useful (0 votes)
50 views

Unit 2 Internal and External Linux Commands

Linux Commands

Uploaded by

rainkedar8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

Unit 2 Internal and External Linux Commands

Linux Commands

Uploaded by

rainkedar8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

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.

Identifying Internal and External Commands

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

This will output: cd is a shell builtin. Indicating that cd is an internal command.

$ type ls

This will output: ls is hashed (/usr/bin/ls). Indicating that ls is an external command


located in the /bin directory.

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.

Top 5 Internal Commands

Command Description

cd Changes the current directory.

echo Displays a line of text or variable value.

exit Exits the current shell session.

pwd Prints the current working directory.

alias Creates an alias for a command.

Top 5 External Commands


Command Description

ls Lists the contents of a directory.

grep Searches for patterns in files.

find Searches for files in a directory hierarchy.

cp Copies files and directories.

mv Moves or renames files and directories.

You might also like