How to check if a command is built-in?

0142

To check if a command is built-in in Linux, you can use the type command. Here’s how to do it:

  1. Open a terminal.

  2. Type the following command, replacing command_name with the command you want to check:

    type command_name

For example, to check if the cd command is built-in, you would run:

type cd

Expected Output

  • If the command is built-in, you will see output like:
    cd is a shell builtin
  • If the command is an external command or an alias, you might see output indicating that, such as:
    ls is aliased to 'ls --color=tty'

This method allows you to determine whether a command is built into the shell or if it is an external executable.

0 Comments

no data
Be the first to share your comment!