What is the difference between internal and external commands in Linux?

Collapse

Unconfigured Ad Widget

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Rachel S
    Senior Member
    • Apr 2022
    • 101

    What is the difference between internal and external commands in Linux?

    Please clarify the difference between an internal and an external command in Linux.
    Thanks in Advance!
  • zayn_william
    Senior Member
    • Apr 2022
    • 106

    #2
    Hi Rachel,

    In Linux, commands can be classified as internal and external commands based on how they are executed and how they interact with the operating system.

    Internal commands are built-in functions of the shell (e.g., bash, zsh) and are executed directly by the shell without invoking any external program. Examples of internal commands include cd, echo, and history. Since internal commands are executed directly by the shell, they are usually faster and more efficient than external commands.

    External commands, on the other hand, are standalone executable programs that are stored in the file system and executed by the shell. Examples of external commands include ls, grep, and cat. These commands are stored in directories listed in the system's PATH variable, so the shell can find and execute them.

    In summary, the main difference between internal and external commands in Linux is that internal commands are built into the shell and executed directly, while external commands are standalone programs that are executed by the shell after being located in the file system through the system's PATH variable.

    Hopefully, this information will be useful to you.

    Comment

    Working...
    X