deb¶
Notes and tips about working with the .deb package format.
Examples¶
Show packages that can be updated¶
Show installed package versions¶
## -V = sort by version (GNU sort only)
/usr/bin/dpkg-query -W --showformat '${Package} ${Version} ${Status}\n' | sort -k2 -V | column -t
List files in packages that are available in configured repositories¶
Find a file available inside packages that are available in configured repositories¶
Show a list of packages that are installed or have left things on the filesystem¶
Show which package a file came from¶
List files in package that is installed¶
List files in package that is not installed¶
List packages available in the repository¶
Show information about a package¶
Show reverse dependencies of a package¶
Show reverse dependencies of installed package¶
Re-install many packages and validate that they were re-installed¶
When apt-get install --reinstall isn't good enough, this is the next option. This should not be done unless you're willing to reload the system if it fails.
## Generate a list of packages
dpkg -l | grep 'python-' > dpkg-l-python ;
## Remove and re-install each individual package one at a time
awk '{print $2,$3}' dpkg-l-python |
while read -r p v ; do
echo "Working on $p version $v" ;
sudo dpkg --purge --force-depends "$p" ;
sudo apt-get install "${p}=${v}" ;
done ;
## Validate that all packages are re-installed with the right version
awk '{print $2,$3}' dpkg-l-python |
while read -r p v ; do
dpkg -l "$p" | grep "$v" || echo "ERROR: Problem with $p $v" ;
done ;