2

bash has an internal command called kill, and also in Linux, there is an external command (program) called kill.

When I execute kill in bash, the internal command kill is executed.

I have two questions:

  1. Is there a setting that I can change to make the external command be executed instead of the internal command by default (without specifying the full path of the external command of course).
  2. Is it a standard behavior for the internal command to be executed instead of the external command by default in all (major) shells, or is it just a bash thing?
  • You can try alias kill='/bin/kill'. alias is prior to builtin and external command. – frams Nov 25 '17 at 6:32
  • Why would you want the external command to be the default? – egmont Nov 25 '17 at 9:16
3
  1. Use env to invoke it.

    $ env kill
    kill: not enough arguments
    $ kill
    kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
    
  2. All shells and command processors.

2

To your first question: Yes, there is a setting to make the external command be executed instead of the internal command by default.

You can turn builtin off by

enable -n COMMAND

You can turn builtin on by

enable COMMAND

or you can change the priority of the command. The priority of bash command is:

  • alias, it's highest
  • function
  • builtin
  • external command in $PATH

To your second question: I think you can always assume internal command is prior to external command. It's not only a bash thing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.