Differences
This shows you the differences between two versions of the page.
— |
linux:how-to-reset-command-path-in-bash [2017-08-08 19: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: | ||
+ | |||
+ | < | ||
+ | #nano example.txt | ||
+ | -bash: / | ||
+ | directory | ||
+ | </ | ||
+ | |||
+ | 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. | ||
+ | |||
+ | < | ||
+ | # which nano | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | # whereis nano | ||
+ | nano: / | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | # echo $PATH | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | 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: | ||
+ | |||
+ | < | ||
+ | hash -r | ||
+ | </ | ||
+ | |||
+ | The **hash** command is a bash built-in to reload bash. | ||
+ | |||
+ | \\ | ||
+ | \\ |