I made some mistake in my .profile during adding some path, now I can't login into my account. All i can do is enter terminal ctrl+alt+f3 and login there. How can I edit from there this file and make everything back to niemal?

  • You can use vi editor. Google using vi editor – FedonKadifeli May 18 at 15:21
  • Use a non-graphic editor, vi, vim, ed, nano. You will have to read the man page first. Or see if the editor you used left a backup file ~/.profile~. – waltinator May 18 at 15:23
  • I cant use command vi or even simple ls, it shows error that this command is in /bin and /bin is not in the PATH – Emil Majer May 18 at 15:28
  • I found solution, I added bin to path by typing export PATH=/usr/bin:/bin then I can use vim. – Emil Majer May 18 at 15:42

There are CLI editors available in Ubuntu:

If you're unable to simply call nano or vi you can try with absolute paths:

/bin/nano .profile


/usr/bin/vi .profile

And if you want to bring the default .profile back you can use the template from /etc/skel/.profile

/bin/cp /etc/skel/.profile /home/yourname/.profile

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.