Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been playing around with the ~/.profile file trying to add something permanently to my $PATH variable and it seems i have done some damage.

I can't log into ubuntu now. When I enter my password the screen goes black for 1 second and then it goes back to the login screen. If I press Ctrl+Alt+F3 I can log in with the command line. My question is how can I edit ~/.profile from the command line so I can log in again ?

share|improve this question
up vote 6 down vote accepted

You can edit the file using

nano ~/.profile

To get the default ~/.profile back use

cp /etc/skel/.profile ~/.profile

As this will overwrite your modified version you may want to save your version first:

cp ~/.profile ~/.profile.invalid
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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