mirror of
https://github.com/nushell/nushell.git
synced 2024-11-15 04:54:46 +01:00
3.4 KiB
3.4 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:
/home/bob> which python
━━━━━━━━┯━━━━━━━━━━━━━━━━━┯━━━━━━━━━
arg │ path │ builtin
────────┼─────────────────┼─────────
python │ /usr/bin/python │ No
━━━━━━━━┷━━━━━━━━━━━━━━━━━┷━━━━━━━━━
/home/bob> which cargo
━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━
arg │ path │ builtin
───────┼────────────────────────────┼─────────
cargo │ /home/bob/.cargo/bin/cargo │ No
━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━
which
will identify nushell commands:
/home/bob> which ls
━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━
arg │ path │ builtin
─────┼──────────────────────────┼─────────
ls │ nushell built-in command │ Yes
━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━
/home/bob> which which
━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━
arg │ path │ builtin
───────┼──────────────────────────┼─────────
which │ nushell built-in command │ Yes
━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━
Passing the all
flag identifies all instances of a command or binary
/home/bob> which ls --all
━━━┯━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━
# │ arg │ path │ builtin
───┼─────┼──────────────────────────┼─────────
0 │ ls │ nushell built-in command │ Yes
1 │ ls │ /usr/bin/ls │ No
━━━┷━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━
which
will also identify local binaries
/home/bob> touch foo
/home/bob> chmod +x foo
/home/bob> which ./foo
━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━
arg │ path │ builtin
───────┼───────────────┼─────────
./foo │ /home/bob/foo │ No
━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━