What is the difference between a built-in command and an external command in Linux?

0203

In Linux, the difference between built-in commands and external commands is as follows:

  1. Built-in Commands:

    • These commands are part of the shell itself (e.g., Bash, Zsh).
    • They are executed directly by the shell without needing to create a new process.
    • Examples include cd, echo, and exit.
    • Built-in commands are generally faster since they don't involve loading an external program.
  2. External Commands:

    • These commands are separate executable files located in the filesystem (e.g., /bin, /usr/bin).
    • When executed, the shell creates a new process to run the command.
    • Examples include ls, grep, and cp.
    • External commands may take longer to execute due to the overhead of starting a new process.

If you have more questions or need clarification, feel free to ask!

0 Comments

no data
Be the first to share your comment!