All Collections
Error Messages and Tech Tips
Solving -bash: command not found
Solving -bash: command not found

If you are seeing "-bash: command not found" every time you enter a command, then something is definitely wrong.

Islam Essam avatar
Written by Islam Essam
Updated over a week ago

If you see -bash: command not found every time you enter any command in bash, then most likely, bash is not configured correctly in your OS environment.

One common cause when this can happen is if you have an incorrectly-set PATH variable.

Finding the currency path variable:

To check your current PATH variable, you may type the following:

echo $PATH

The output you see will differ depending on the your OS, but something similar to the following should show up:


The most important part is that, all bin and sbin directories are included, since this is where we have all binaries installed by default.

Setting the path variable:

To solve this issue, you can update your path variable to include the important directories that include most of the little programs that unix relies on to operate.

You can set it using the following command:

export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:$PATH

However, you will need to make this update permanent once you confirm it works. Here is a one-liner for bash that

echo 'export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:$PATH' >> ~/.bashrc

Then we will need to refresh or current session:

source ~/.bashrc
Did this answer your question?