Search

Linux which command

Show which executable would run when you enter a command name.

Availability: Common Linux commands; shell built-ins and external implementations may differ by distribution.中文

Syntax

which [-a] NAME...

Examples

Show the first python3 executable found in PATH.

which python3

List all python3 matches in PATH.

which -a python3

Parameters, options and clauses

Option / clauseDescription
-aPrint every matching executable found in PATH.
--read-aliasRead aliases from standard input (in supported implementations).
--skip-aliasIgnore aliases (in supported implementations).
--read-functionsRead shell functions from standard input (in supported implementations).
Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory