Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

How can I do this without reinstalling the rest of the files as well?

share|improve this question
up vote 8 down vote accepted

Download the package, for example transmission-daemon, with

sudo apt-get --download-only install transmission-daemon

unpack the package with

mkdir ~/dummy
dpkg-deb -x /var/cache/apt/archives/transmission-daemon_*.deb ~/dummy

restore the file, for example /etc/init.d/transmission-daemon

sudo cp ~/dummy/etc/init.d/transmission-daemon /etc/init.d

remove the dir

rm -rf ~/dummy
share|improve this answer
1  
It should also be noted that apt-get download downloads to the current working directory . – user369927 Jan 18 '15 at 16:14

I know this is a bit old, but here's my improvement:

$ sudo apt-get download <package-name>

instead of

$ sudo apt-get --download-only install <package-name>

I had a situation where the package was already installed (hence, the proposed solution didn't work), and I wanted to restore just one config file, in order to fix the problem.

Cheers

share|improve this answer
1  
if you have a package already installed then it's typically found in /var/cache/apt/archives/ and you shouldn't have to download it. – Ahmed Masud Jan 21 '14 at 17:00
    
Yes, but only if the package was installed relatively recently, and the archives have not been manually or automatically cleaned. – joeytwiddle Jan 29 at 4:33

Your Answer

 
discard

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.