Removed a file by accident

Marcelo Magno T. Sales mmtsales at gmail.com
Sun Oct 10 22:02:57 UTC 2010


Em domingo 10 outubro 2010, Ric Moore escreveu:
> On Sun, 2010-10-10 at 16:57 -0300, Marcelo Magno T. Sales wrote:
> > Em sábado 09 outubro 2010, Knight escreveu:
> > > On Sat, 2010-10-09 at 09:15 -0500, C de-Avillez wrote:
> > > > On Sat, 09 Oct 2010 11:16:26 +0200
> > > > 
> > > > Knight <knightotp at gmail.com> wrote:
> > > > > In order to find out to which package a file belongs you can
> > > > > (out of the box) use:
> > > > > 
> > > > > dpkg -S /sbin/restart
> > > > 
> > > > dpkg only searches on installed packages. A more generic search
> > > > can be done via 'apt-file'. To install it, 'sudo apt-get
> > > > install apt-file'.
> > > 
> > > Sorry first paragraph has typo's.
> > > Should be:
> > > 
> > > And you want to tell me that you have files on your computer that
> > > you didn't install and that don't belong to any packages or are
> > > _not_ placed there by yourself or your users? (I cannot think of
> > > any on my own systems)
> > 
> > No, it is the other way around. The OP said he had removed the file
> > accidentally. So, the file was not there anymore and therefore dpkg
> > could not tell you the package which had installed that file.
> 
> But, the original package wasn't removed, so shouldn't it be able to
> tell him?? Of course, he could just hunt around using synaptic /
> properties. I'm gonna have to dig here, but I found a dpkg command
> line that would restore a missing file if the package name  was
> known. From what I dimly recall the command was similar to rpm
> --force. Gads, I better find that link to explain better, but it
> seems that dpkg will not install or update a missing file, unless
> explicitly told to. The command line to make it do so was a real
> finger twister. Ric

Yes, dpkg will reinstall a package and restore the files it had 
installed previously, if you know the name of the package. But the 
problem is that he didn't have this information. He wanted to find out 
from what package that file came from, but the file did not exist 
anymore. It seems dpkg can't help in this situation.

[]'s
Marcelo




More information about the ubuntu-users mailing list