Find the path to a file (LINUX)

The which command searches an entire path to find the name of an executable file.

which [options] [--] programname [...]

Options:

--version, -[vV] Print version and exit successfully.
--help, Print this help and exit successfully.
--skip-dot Skip directories in PATH that start with a dot.
--skip-tilde Skip directories in PATH that start with a tilde.
--show-dot Don't expand a dot to current directory in output.
--show-tilde Output a tilde for HOME directory for non-root.
--tty-only Stop processing options on the right if not on tty.
--all, -a Print all matches in PATH, not just the first
--read-alias, -i Read list of aliases from stdin.
--skip-alias Ignore option --read-alias; don't read stdin.
--read-functions Read shell functions from stdin.
--skip-functions Ignore option --read-functions; don't read stdin.


Examlpe:

which ls
alias ls='ls --color=tty'
/bin/ls

For the more advanced search recommended the find command.

No comments:

Recent Posts