Ying Zhao
Ying Zhao

Reputation: 83

Accidentally wiped out PATH definition in Bash shell

I created a.bash_profile and defined

    export PATH=/user/local/bin 

rather than

    export PATH=/user/local/bin:$PATH

Then, I ran

    source ~/.bash_profile

Now none of the command, e.g., ls works. Is there a way to back out this change? Thank you.

Upvotes: 1

Views: 305

Answers (1)

Jake Lishman
Jake Lishman

Reputation: 927

If you have fixed your .bash_profile file, you just restart bash to get your $PATH back. If that's not an option, or you can't fix the file externally, you can do export PATH="/bin:/usr/bin:/usr/local/bin", which should give you enough to get to vi or some other text editor so you can fix your .bash_profile, then you can restart bash.

Upvotes: 3

Related Questions