Finkers: a blog about Fink

Finding files in Fink

November 6, 2009 · Leave a Comment

Let’s see some methods to find files and their packages in Fink.

Using find

find is a command that is provided by most, if not all, Unix-based systems, including Mac OS X. Let’s say you want to find a file named zipfile.py in your Fink installation. On my system,

$ find /sw -name zipfile.py
/sw/lib/python2.5/zipfile.py
/sw/lib/python2.6/zipfile.py

You can be more specific if you’re sure that a file resides in a certain directory, e.g.

$ find /sw/lib -name libgutils\*dylib
/sw/lib/fontforge/libgutils.1.0.3.dylib
/sw/lib/fontforge/libgutils.1.dylib
/sw/lib/fontforge/libgutils.dylib

In the command above I also used \* to indicate that I was interested in any file whose name starts with libgutils and ends with dylib.

Furthermore, depending on your configuration, you may use locate or mdfind for this purpose.

Using dpkg

Fink uses a fork of Debian’s dpkg tool for binary package management. Here are some useful dpkg commands.

If you want to find out which package installed a given file, use dpkg -S. For example,

$ dpkg -S zipfile.py
python26: /sw/lib/python2.6/zipfile.pyc
python26: /sw/lib/python2.6/zipfile.pyo
python26: /sw/lib/python2.6/test/test_zipfile.pyc
python26: /sw/lib/python2.6/test/test_zipfile.pyo
python25: /sw/lib/python2.5/zipfile.py
python25: /sw/lib/python2.5/zipfile.pyc
python25: /sw/lib/python2.5/zipfile.pyo
python25: /sw/lib/python2.5/test/test_zipfile.pyc
python25: /sw/lib/python2.5/test/test_zipfile.pyo
python26: /sw/lib/python2.6/test/test_zipfile.py
python25: /sw/lib/python2.5/test/test_zipfile.py
python26: /sw/lib/python2.6/zipfile.py

Specifying an absolute path will limit the results:

$ dpkg -S /sw/lib/python2.6/zipfile.py
python26: /sw/lib/python2.6/zipfile.py

If you want to list the files installed by a given package (e.g. the di package), use dpkg -L:

$ dpkg -L di
/.
/sw
/sw/bin
/sw/bin/di
/sw/bin/mi
/sw/share
/sw/share/doc
/sw/share/doc/di
/sw/share/doc/di/MANIFEST
/sw/share/doc/di/README
/sw/share/man
/sw/share/man/man1
/sw/share/man/man1/di.1

The grep command can be useful to filter the results: to list only the binaries (programs) installed under /sw/bin,

$ dpkg -L di | grep ^/sw/bin
/sw/bin
/sw/bin/di
/sw/bin/mi

If you have a binary package (i.e., a .deb file that was either built on your machine or obtained via a binary distribution), you need to use dpkg -c instead:

$ dpkg -c /sw/fink/debs/bibclean_2.11.4-2_darwin-i386.deb
drwxr-xr-x root/admin        0 2009-09-16 09:04 ./
drwxr-xr-x root/admin        0 2009-09-16 09:04 ./sw/
drwxr-xr-x root/admin        0 2009-09-16 09:04 ./sw/bin/
-rwxr-xr-x root/admin   112564 2009-09-16 09:04 ./sw/bin/bibclean
drwxr-xr-x root/admin        0 2009-09-16 09:04 ./sw/share/
drwxr-xr-x root/admin        0 2009-09-16 09:04 ./sw/share/doc/
drwxr-xr-x root/admin        0 2009-09-16 09:04 ./sw/share/doc/bibclean/
-rw-r--r-- root/admin    26550 2009-09-16 09:04 ./sw/share/doc/bibclean/README
-rw-r--r-- root/admin     2932 2009-09-16 09:04 ./sw/share/doc/bibclean/bibclean.copyright
-rw-r--r-- root/admin    48768 2009-09-16 09:04 ./sw/share/doc/bibclean/bibclean.pdf
-rw-r--r-- root/admin    76512 2009-09-16 09:04 ./sw/share/doc/bibclean/bibclean.ps
-rw-r--r-- root/admin    55226 2009-09-16 09:04 ./sw/share/doc/bibclean/bibclean.txt
drwxr-xr-x root/admin        0 2009-09-16 09:04 ./sw/share/man/
drwxr-xr-x root/admin        0 2009-09-16 09:04 ./sw/share/man/man1/
-rw-r--r-- root/admin    42974 2009-09-16 09:04 ./sw/share/man/man1/bibclean.1

The directory/folder /sw/fink/debs contains convenient symbolic links to the actual .deb files created when packages were built on your machine. On the other hand, .deb files obtained via binary distributions are located under /sw/var/cache/apt/archives.


Categories: usage
Tagged: , , , , , , , , , , , ,

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment