20

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 ?

2 Answers 2

35

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
1
  • saw that /etc/skel have most of the templates that you should have for solve configuration lost Mar 25, 2020 at 13:53
1

In case you get an error saying:

cp /etc/skel/.profile: command not found

try:

/usr/bin/cp /etc/skel/.profile ~/.profile

If that doesn't work, try with sudo privileges using:

/usr/bin/sudo /usr/bin/cp /etc/skel/.profile ~/.profile

Then reboot

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .