Reputation: 89
While making some configurations to include JAVA_HOME
in the environment, I created the file .bash_profile
, updated it with JAVA_HOME
and PATH
variables. While updating the PATH
variable, I forgot to include PATH:
in the command EXPORT PATH='PATH:/usr/...
. Then, I ran the command source /.bash_profile
and it messed up everything. Now I cannot find the basic commands too in the PATH
and shows error in commands like vi
, ls
etc.
I now want everything to be restored back to the previous state. Please helm me !
Upvotes: 0
Views: 2390
Reputation: 57646
You probably wanted your .bash_profile
to look like this:
export PATH="$PATH:/another/path/to/something"
this will append your new path to the existing one (The $
substitutes a variable name with its contents). Also, I recommend using the file ~/.bashrc
for values to be loaded at every bash invocation. (Be sure to make a backup)
So, have you tried turning it on and off? After logging in again, your PATH
should look normal.
Upvotes: 0
Reputation: 53285
You can call commands with their full path - /usr/bin/<command>
or /bin/<command>
usually.
Also you can export a new PATH yourself interactively:
export PATH=/bin:/usr/bin
Also when you edit your .bash_profile
you'll want export PATH=$PATH:<new path>
Upvotes: 1