15

I accidentally made a mistake when I changed my ~/.bash_profile file and now I'm unable to run any command, such as ls, touch, sudo, etc.

When I write echo $PATH I have this result:

$ echo $PATH
/usr/local/bin:
$

And when I type /bin/cat ~/.bash_profile, I have this result:

export PATH=$HOME/local/node/bin:/usr/local/bin:$PATH
export PATH=/usr/local/bin:$PATHh

But I am unable to change it. Can someone help me, please?

Jonathan Leffler
  • 698,132
  • 130
  • 858
  • 1,229
Alessandro
  • 633
  • 1
  • 7
  • 19

1 Answers1

26

If you can do /bin/cat, you should be able to /usr/bin/vi, too. Alternately, just fix it in your local shell:

PATH=/bin:/usr/bin:/sbin:/usr/sbin

And then running your favourite editor should work again.

Carl Norum
  • 210,715
  • 34
  • 410
  • 462