I permanently changed my PATH variable by mistake, and I am unable to login now. How to change my PATH variable to default?

/usr/bin/sudo /bin/nano /etc/environment

Possible methods:

  • 1st try to log in using a TTY (control-alt-f1).
  • If that does not work boot from a live DVD.

and then use

sudo nano /etc/environment

from command line and edit out your mistake. Save and reboot to test what you did is correct.


In case you need it:

 $ more /etc/environment 
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"