Debian/Ubuntu: Using dpkg to find installed package by string and list its files

Saturday, 08 September 2012

This is a note to self, and I'm sure it will also benefit whoever always forgets what the right tool is: apt-get, aptitude, apt-cache or dpkg.

1. Listing packages from the command line

dpkg --get-selections |grep <your-search-string>

 For example, if you need to know what PHP5 related packages are installed the corresponding command is:

tudor@pandora / $ dpkg --get-selections | grep php5
libapache2-mod-php5        install
php5            install
php5-cli          install
php5-common          install
php5-curl          install
php5-gd            install
php5-memcached          install
php5-mysql          install
php5-sqlite          install
php5-xcache          install
tudor@pandora / $

2. Listing files for a given package  from the command line:

This provides a quick way to locate the ini files or data/cache directories for a given package

dpkg -L <package-name>

 

 tudor@pandora / $ dpkg -L libapache2-mod-php5
/.
/usr
/usr/share
/usr/share/doc
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/libapache2-mod-php5
/usr/lib
/usr/lib/apache2
/usr/lib/apache2/modules
/usr/lib/apache2/modules/libphp5.so
/usr/lib/php5
/usr/lib/php5/20090626+lfs
/etc
/etc/apache2
/etc/apache2/mods-available
/etc/apache2/mods-available/php5.conf
/etc/apache2/mods-available/php5.load
/etc/php5
/etc/php5/apache2
/usr/share/doc/libapache2-mod-php5
/etc/php5/apache2/conf.d
tudor@pandora / $ 
 

Credits go to this HowToGeek article.



Give us some social love (it really works now)!

Reddit! Del.icio.us! StumbleUpon! Yahoo! Swik!



Be first to comment this article
RSS comments

Write Comment
  • Please keep the topic of messages relevant to the subject of the article.
  • Please don't use comments to plug your web site. Links are rel='nofollow'-ed
  • Please refresh the page if you're having trouble with the security image code
Name:
E-mail
Homepage
Title:
Comment:

:) :grin ;) 8) :p
:roll :eek :upset :zzz :sigh
:? :cry :( :x
Code:* Code

Last Updated ( Saturday, 08 September 2012 )
 
Post and Bid on Joomla/PHP projects! Join EUFreelance.com for free!

Europe freelancer directory

Newsletter

Subscribe to TeachMeJoomla's newsletter
Name:
Email:


Auto tags

None yet