Differences

This shows you the differences between two versions of the page.

Link to this comparison view

linux:how-to-reset-command-path-in-bash [2017-08-08 12:29:46] (current)
rory.blanchard created
Line 1: Line 1:
 +====== How to Reset the Command Path in Bash ======
  
 +Occasionally when using bash after installing or updating packages, you may run into a problem like the following when trying to invoke a command:
 +
 +<​code>​
 +#nano example.txt
 +-bash: /​usr/​bin/​nano:​ No such file or
 +directory
 +</​code>​
 +
 +In this case, after verifying the location of nano through which or whois, and checking your $PATH, you show the path is correct and the command is installed correctly.
 +
 +<​code>​
 +# which nano
 +/​usr/​bin/​nano
 +</​code>​
 +
 +<​code>​
 +# whereis nano
 +nano: /​usr/​bin/​nano /​usr/​share/​nano /​usr/​share/​man/​man1/​nano.1.gz
 +</​code>​
 +
 +<​code>​
 +# echo $PATH
 +/​usr/​local/​jdk/​bin:/​usr/​local/​sbin:/​usr/​local/​bin:/​usr/​sbin:/​usr/​bin:/​root/​bin/​
 +</​code>​
 +
 +Once you've confirmed that it should be working, the problem can be fixed in one of two ways.
 +
 +**1.** Start a new bash session by terminating your current one.
 +
 +**2.** Run the following command:
 +
 +<​code>​
 +hash -r
 +</​code>​
 +
 +The **hash** command is a bash built-in to reload bash.
 +
 +\\
 +\\