Find Path of a Command in Ubuntu

In this article, we would discuss how to find Path of a command in Ubuntu. Mainly, we have shell commands and file system commands. Shell commands are built-in to the shell itself. Whereas, file system commands are invoked from the file system.

To view the list of built-in commands of Bourne Again shell (BASH) –


It would display all the internally defined built-in commands. Now, to get information about a specific command, for instance – umask

help umask

To look for information about file system commands, precede the command-name with man or info. For instance, to look for ssh command –

man ssh

You may wonder, why we are discussing built-in and file system commands instead of finding the Path of a command. We will address this soon in Additional Info section of this article.

Find Path of a Command in Ubuntu

First understand how a shell finds the command we type. The directory in which it will search for the commands are stored in shell’s PATH Environment variable. To view the directories –

echo $PATH

The output may resemble –


So, the shell would first look for command in /usr/local/sbin. Thereafter, in /usr/local/bin and so on, till /bin. In other words, it checks the directories sequentially.

There are three methods we would discuss to find Path of a command –

Method I. Use type built-in shell command.

Let’s say we want to look for command ssh. So, issue the following in terminal –

type -a ssh

This would return with –

ssh is /usr/bin/ssh
ssh is /bin/ssh

Method II. Use which command –

which ssh

It would return with


Method III. Using plocate command –

We need to install the package plocate here. It is available through standard Ubuntu repository. Therefore, first update the repository and then install the package –

sudo apt update
sudo apt install plocate

Note: Above operations require superuser privileges. In case you don’t have one then, we advise you to contact your System Administrator for assistance.

To look for ssh

plocate ssh

This one is bit tricky, because there is a complete list of directory where ssh could be located. Nonetheless, it is useful in certain scenarios.

In conclusion, we have discussed how to find Path of a command in Ubuntu.

Additional Info –

Initially, we have discussed about built-in and file system commands instead of directly coming to the purpose of article. This was deliberately done because, none of the above mentioned methods would provide you the location of the built-in shell commands. Try this one yourself, using built-in shell command umask

type -a umask
which umask
plocate umask

None of the above can provide you the Path.

Similar Posts