DPKG Cheatsheet
#
dpkg
is a low-level package management tool for Debian-based systems. It is used to install, remove, and manage Debian packages.
Basic Commands
#
Command/Option | Example | Description |
---|
dpkg -i <package.deb> | dpkg -i nginx_1.14.0-0ubuntu1_amd64.deb | Install a Debian package |
dpkg -r <package> | dpkg -r nginx | Remove a package, but keep configuration files |
dpkg -P <package> | dpkg -P nginx | Purge a package, removing configuration files |
dpkg -l | dpkg -l | List all installed packages |
dpkg -L <package> | dpkg -L nginx | List all files installed by a package |
dpkg -S <file> | dpkg -S /usr/sbin/nginx | Find the package that owns a specific file |
dpkg -c <package.deb> | dpkg -c nginx_1.14.0-0ubuntu1_amd64.deb | List the contents of a Debian package file |
Command/Option | Example | Description |
---|
dpkg -s <package> | dpkg -s nginx | Display detailed information about an installed package |
dpkg -p <package> | dpkg -p nginx | Display detailed information about a package that is not installed |
Configuration and Status
#
Command/Option | Example | Description |
---|
dpkg --configure -a | dpkg --configure -a | Reconfigure unpacked packages that have not yet been configured |
dpkg --audit | dpkg --audit | Report packages with problems (e.g., broken dependencies) |
Miscellaneous
#
Command/Option | Example | Description |
---|
dpkg-deb -b <directory> <package.deb> | dpkg-deb -b mypackage mypackage_1.0-1_all.deb | Build a Debian package from a directory |
dpkg-deb -x <package.deb> <directory> | dpkg-deb -x nginx_1.14.0-0ubuntu1_amd64.deb /tmp/nginx | Extract the contents of a Debian package file |
This cheatsheet covers essential dpkg
commands and options for managing Debian packages on Debian-based systems.