The officially official Devuan Forum!

You are not logged in.

#1 2017-03-12 14:36:26

Registered: 2016-11-25
Posts: 2,441  

Package manager magic incantations

I think I collected all of these from (and I have not tested all of them.)

Edit: I'm adding code boxes to the ones I test. Note that some of these commands may give you strange results if you have multiple repos enabled, like jessie,ascii,ceres. Don't do that!



To find which installed packages are from debian-multimedia (works as user):

dpkg-query -W --showformat='${Package}\t${Maintainer}\n' |grep "Christian Marillat"

To show packages from contrib and non-free, either one of the following. The second is more specific. (e.g. the first one gives a false positive on libclucene-contribs1 because "contrib" is in the package name.)

dpkg-query -W --showformat='${Package}\t${Section}\n' | egrep -e "non-free|contrib"
dpkg-query -W --showformat='${Package}\t${Section}\n' | awk '/non-free|contrib/ { print $0 }'

Re: List installed software from non-free repo
bugsbunny » 2011-01-30 08:50

    aptitude search ~i~s"non-free~|contrib"
    aptitude search ~i~snon-free ~i~scontrib

If you want package names, section, and archive (testing, stable, unstable):

aptitude search ~i~snon-free ~i~scontrib -F"%p#  %s#  %t#"

or maybe name, version, archive

aptitude search ~i -F"%p# %v# %t#"

get package names and sizes, sorted by size:
dpkg-query -W --showformat='${Installed-Size}\t${Package}\n' > package_sizes
awk '{ printf "%.7d %s\n", $1, $2 "\n" }' package_sizes | sort

Show which repo (which release) packages came from:
aptitude search "?narrow(?installed,?archive(stable))"
aptitude search "?narrow(?installed,?archive(oldstable))"

Or did not come from:
aptitude search "?narrow(?installed,?not(?archive(stable)))"

To get a list of dependencies from a .deb file:
$ dpkg -e d4x_2.5.7.1-5_amd64.deb
$ su
# DEPS=$(grep ^Depends DEBIAN/control | sed 's/,/\n/g' | sed 's/(.*//;s/Depends: //;s/^ //')
# apt-get update
# apt-get install $DEPS   ### Bad idea!!! This installs everything in the list. There may be redundancies.
# apt-get clean
# exit

This line works if there's a "|" in the output.
DEPS=$(grep ^Depends DEBIAN/control | sed 's/,/\n/g' | sed 's/(.*//;s/Depends: //;s/^ //;s/|.*$//')

Better way:
dpkg -i my-deb_5.0-6_i386.deb
apt-get -f install


#2 2017-03-16 11:40:31

From: North Carolina, USA
Registered: 2016-11-30
Posts: 201  

Re: Package manager magic incantations

This info has been copied, pasted, and filed away into my "notes" folder for future reference.  It will come in handy. 

Thanks fsr!


#3 2017-07-08 10:37:40

Registered: 2017-06-28
Posts: 11  

Re: Package manager magic incantations

dpkg --get-selections > package.list


#4 2017-07-08 12:27:31

From: /usr/bin/pekman
Registered: 2017-05-11
Posts: 58  

Re: Package manager magic incantations

Ooohhh! Very cool. Thanks for this


Board footer