In this guide, we will go through how to find path to a command in Linux. We will look at the most common commands used in Linux such as which, whereis and type to find path to a command.
- The which command is installed by default on most Linux systems. To get the path to a command use which as shown below.
- You can output all similar path names by including the -a option as shown below.
which -a vlc
- The whereis command finds the location of a specific command’s binaries, source and manual page.
vlc: /usr/bin/vlc /usr/lib/x86_64-linux-gnu/vlc /usr/share/vlc /usr/share/man/man1/vlc.1.gz
- To show the source use the
whereis -s vlc
- To show manual use the
whereis -m vlc
- The type command can determine whether a target is built-in, a function, an alias, or an external executable in addition to displaying the path of a Linux command. Print the path of any command using the type like the example below.
type -P pwd
- Remove the
-Poption to view the command description
pwd is a shell builtin
- To show the command description executable type and its location using the -a option.
type -a pwd
pwd is a shell builtin pwd is /usr/bin/pwd pwd is /bin/pwd
- That concludes our guide on how to find path to a command in Linux.
Read more about whereis command
Read more about type command
How to kill a process in Linux