Ubuntu – How to reset user to default settings

command linedata-recoveryhome-directory

Long story short, I accidentally ran sudo rm -rf ~ and as a result removed most of my home directory. In a panicked state, and with a bit of research, I attempted to recover what I could with extundelete, which has recovered some files.

That aside I have 'lost' the usual files in the home directory, I only have the Downloads folder left and since I didn't have anything too vital stored in the other directories I would like to restore them if at all possible.

I have looked in the file ~/.config/user-dirs.dirs and I have the following:

# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
# 
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/"
XDG_PUBLICSHARE_DIR="$HOME/"
XDG_DOCUMENTS_DIR="$HOME/"
XDG_MUSIC_DIR="$HOME/"
XDG_PICTURES_DIR="$HOME/"
XDG_VIDEOS_DIR="$HOME/"

All I want is to restore those folders and all system settings back to default, but I don't want to re-install Ubuntu as I don't want to lose any software I have down loaded.

At this point any help would be appreciated.

Thanks in advance,

J

Update:

I have created another admin user and everything works as it did previously leading me to believe that this is a local user issue, I am going to attempt to analyse the difference in the files between the two accounts and see if I get any improvements, update to come.

Best Answer

You may want to copy the files from /etc/skel.

cp -rT /etc/skel/ "$HOME"

Those are the files which every newly created user starts with in the HOME folder, and are sufficient to be able to log in.

Related Question