0

How would I find the command path for exit? I have already tried which exit but that returns nothing (it just goes to a new line).

I have also played around cd /usr/bin, and when in that directory using ls -R, but I haven't found it.

2 Answers 2

2

You're not going to find it in any directory because it's a builtin command (man exit):

Shell builtin commands are commands that can be executed within the running shell's process. Note that, in the case of csh(1) builtin commands, the command is executed in a subshell if it occurs as any component of a pipeline except the last.

A list of the Bash builtin commands for macOS can be found at the top of the man page (man builtin).

3
  • 3
    You can check where commands come from (a path, an alias, a function, or a builtin) with the type command. e.g. type exit
    – Scot
    Jun 5, 2017 at 0:37
  • And type type will explain you what is type :).
    – dan
    Jun 5, 2017 at 12:59
  • 1
    @danielAzuelos - That's Inception :-D
    – Allan
    Jun 5, 2017 at 13:01
0

If your shell is ksh, zsh, or bash, you can use:

type exit

or

command -V exit

To list the builtin commands

bash:

compgen -b

or

enable -a

ksh:

 builtin

zsh:

 echo ${(k)builtins}

For builtin manuals

bash:

 help exit

ksh:

 exit --man

zsh:

 man zshbuiltins

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .