Linux command
dpkg 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Install
sudo dpkg -i [path/to/file.deb]
Remove
sudo dpkg -r [package]
List
dpkg -l [pattern]
Example
dpkg -L [package]
Example
dpkg -c [path/to/file.deb]
Example
dpkg -S [path/to/file]
Purge
sudo dpkg -P [package]
Example
dpkg -s [package]
说明
dpkg is the low-level package manager for Debian-based systems. It handles the installation, removal, and management of .deb packages. Higher-level tools like apt and apt-get use dpkg internally.
参数
- -i, --install file.deb
- Install a package from a .deb file
- -r, --remove package
- Remove a package (keep configuration files)
- -P, --purge package
- Remove a package and its configuration files
- -l, --list pattern
- List packages matching pattern
- -L, --listfiles package
- List files installed by a package
- -c, --contents file.deb
- List contents of a .deb file
- -S, --search path
- Search for a package owning a file
- -s, --status package
- Display package status details
- --configure package
- Configure an unpacked package
- --unpack file.deb
- Unpack but don't configure a package
- --get-selections _pattern_
- Get list of package selections
- --set-selections
- Set package selections from stdin
- --audit, -C
- Search for partially installed packages and suggest how to fix them.
- --force-_things_
- Override safety checks (e.g. --force-all, --force-overwrite). Use with care.
- --no-act, --dry-run, --simulate
- Show what would be done without making changes.
FAQ
What is the dpkg command used for?
dpkg is the low-level package manager for Debian-based systems. It handles the installation, removal, and management of .deb packages. Higher-level tools like apt and apt-get use dpkg internally.
How do I run a basic dpkg example?
Run `sudo dpkg -i [path/to/file.deb]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -i, --install file.deb do in dpkg?
Install a package from a .deb file