mirror of
https://github.com/nushell/nushell.git
synced 2024-12-03 13:53:59 +01:00
2.5 KiB
2.5 KiB
which
Finds a program file.
Usage:
which {flags}
Parameters
- application: the name of the command to find the path to
Flags
- --all: list all executables
Examples
which
finds the location of an executable:
> which python
─────────┬─────────────────
arg │ python
path │ /usr/bin/python
builtin │ No
─────────┴─────────────────
> which cargo
─────────┬────────────────────────────
arg │ cargo
path │ /home/bob/.cargo/bin/cargo
builtin │ No
─────────┴────────────────────────────
which
will identify nushell commands:
> which ls
─────────┬──────────────────────────
arg │ ls
path │ nushell built-in command
builtin │ Yes
─────────┴──────────────────────────
> which which
─────────┬──────────────────────────
arg │ which
path │ nushell built-in command
builtin │ Yes
─────────┴──────────────────────────
Passing the all
flag identifies all instances of a command or binary
> which ls --all
───┬─────┬──────────────────────────┬─────────
# │ arg │ path │ builtin
───┼─────┼──────────────────────────┼─────────
0 │ ls │ nushell built-in command │ Yes
1 │ ls │ /bin/ls │ No
───┴─────┴──────────────────────────┴─────────
which
will also identify local binaries
> touch foo
> chmod +x foo
> which ./foo
─────────┬────────────────────────────────
arg │ ./foo
path │ /Users/josephlyons/Desktop/foo
builtin │ No
─────────┴────────────────────────────────