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
  • 730,956
  • 141
  • 904
  • 1,278
Alessandro
  • 643
  • 1
  • 7
  • 20

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
  • 219,201
  • 40
  • 422
  • 469