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.

Anwar
  • 76,649
dariush
  • 619

2 Answers2

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.

Anwar
  • 76,649
  • Why wouldn't something like sudo aptitude reinstall bash not work? – phihag Sep 05 '16 at 10:06
  • 3
    @phihag because reinstall won't get them. they are config file – Anwar Sep 05 '16 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 06 '16 at 06:50
  • 1
    @Dariush aha! apt works in 16.04. I think you're in older version. anyway fixing this – Anwar Sep 06 '16 at 06: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 06 '16 at 06: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.

SAGAR Nair
  • 1,385