1

I have messed with /etc/skel files and stupidly didn't back it up! I need to restore the original files in this directory! How can I find the original files over the internet?

Note: for security reasons only provide Linux official link.

Thanks in advance.

3

2 Answers 2

6

The files /etc/skel/.bashrc, /etc/skel/.bash_logout and /etc/skel/.profile are provided by package bash.

You need to get the bash package and extract the files from it and copy them back in /etc/skel.

  1. Get the bash package's deb file.

    apt-get download bash
    
  2. Then extract the package to /

    sudo dpkg-deb -x bash_4.3-14ubuntu1.1_amd64.deb /
    

    Replace the actual package file name in the above command, if your deb file name isn't exactly same.

5
  • Why wouldn't something like sudo aptitude reinstall bash not work?
    – phihag
    Sep 5, 2016 at 10:06
  • 3
    @phihag because reinstall won't get them. they are config file
    – Anwar
    Sep 5, 2016 at 10:07
  • Thanks for the straight forward and simple answer, need to mention apt download bash is wrong, I've tried to edit it to apt-get download bash but it says you need to edit at least 6 chars(which the answer don't need it!). I am going to accept your answers but please fix it to the future wonders.
    – dariush
    Sep 6, 2016 at 6:50
  • 1
    @Dariush aha! apt works in 16.04. I think you're in older version. anyway fixing this
    – Anwar
    Sep 6, 2016 at 6:54
  • 1
    Thanks, I've installed 16.04.1 and found it sucks(so unstable!) :D re-installed the 14.04 again, love it :)
    – dariush
    Sep 6, 2016 at 6:59
1

You can always get the skel files from your home user dir because , at the time of user creation all skel files will be copied to the new users home directory. So as of now you can find files/ folders in your early created user home directory. Probable folders/files in /etc/skel/ are as follows:

.bash_logout  
.bashrc  
.config  (directory)
.profile  

These files and folder will be there in /home/username/ where the dot(.) infront of it indicates they are hidden. Just take a look and copy back to /etc/skel/ . Thats it.

1
  • 1
    Home directories skel files don't remain in pristine state for long
    – Anwar
    Sep 5, 2016 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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