JP Vossen on 22 Jun 2009 15:27:45 -0700

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Oops, quickly over my head with Ubuntu package management

> Date: Mon, 22 Jun 2009 17:15:25 -0400
> From: Eric <>
> I have a command on my Ubuntu system called sha256sum.  How do I find what 
> package that is in so that I can install it on another server?  I need to access 
> it via PHP to create checksums.  It works just fine on my workstation but does 
> not exist on the target system.

'dpkg -S /path/to/file' is good, except you need to already know where 
the file is.  In this case you do, but you may not always.

'dpkg -L coreutils | grep sha256' is the opposite if what you want, 
since you have to know the package in order to find the file but you 
know the file and want the package.  It's really handy to find out where 
that new <package> you just installed puts stuff though.

apt-file is great but is not installed by default, IIRC.

### I'd do it this way *:
$ dpkg-query --search sha256sum
coreutils: /usr/bin/sha256sum
coreutils: /usr/share/man/man1/sha256sum.1.gz

I dunno how 'coreutils' isn't on your target though.  Bad path?

* Actually, I lied.  What I'd really do is, '$ deb whatprovides 
sha256sum'.  The major problem with that is that 'deb' not only is not 
installed by default, but I wrote it and it's not even packaged.  This 
page should answer all or most of your package management questions, and 
has a download link:

One handy thing 'deb' does is *tell* you how it got the answer, so when 
you are on a system without it you might remember.  (Good theory, never 
works for me though. :-)  OK, bring on the abuse about non-standard 
tools and crutches...  I'm just getting too old to remember all that 
crap; I need all the help I can get.

JP Vossen, CISSP            |:::======|
My Account, My Opinions     |=========|
"Microsoft Tax" = the additional hardware & yearly fees for the add-on
software required to protect Windows from its own poorly designed and
implemented self, while the overhead incidentally flattens Moore's Law.
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --