Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

dpkg is Debian’s lower-level package manager. Use it when you need to install a local .deb archive, inspect package records, complete configuration after an interrupted transaction, remove or purge a package, or determine which package owns a file. Use apt when you need repository downloads and automatic dependency resolution. On a production server, inspect the archive first, make one deliberate change at a time, and verify the resulting package state.

What dpkg does—and how it differs from apt

The Debian Project manual describes dpkg as a medium-level tool for installing, building, removing, and managing Debian packages. It operates directly on the local package database and on the archive or package name you specify. The normal command-line front end for repository access and dependency handling is apt.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Question dpkg apt
Input source A local .deb archive or the local dpkg database Configured repositories, with dependency resolution
Dependency behavior Does not fetch missing dependencies for a local install Calculates and obtains dependency packages
Typical use Install a downloaded archive, configure pending packages, inspect records Install or update packages from repositories
Transaction stage Can unpack an archive and configure packages already in the database Coordinates downloads, unpacking, configuration, and dependency order
Removal policy --remove retains configuration; --purge removes it Provides higher-level package-management workflows that use dpkg underneath

They are complementary, not interchangeable spellings. If a vendor gives you a local archive, dpkg is the direct tool for that file. If a package must be downloaded from repositories or several dependencies must be selected, use apt, then use dpkg commands when you need low-level inspection or recovery.

Check the server before changing packages

Confirm the operating-system family

These commands apply to Debian and Debian-derived systems that use the dpkg database. On another Linux distribution, use that distribution’s package manager instead. Check the operating-system identification before running a package operation:

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.
cat /etc/os-release

Package names, maintainer scripts, service names, and available architectures vary by distribution release. Do not assume that a package built for one Debian release is appropriate for another simply because both systems have a dpkg command.

Check the native architecture

dpkg --print-architecture

The result is the system’s default Debian architecture, such as amd64 or arm64. Compare it with the architecture encoded in the archive filename and metadata. An architecture mismatch can prevent installation or produce a package that cannot run on the host.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use appropriate privileges

Reading package metadata usually works as an unprivileged user. Installing, configuring, removing, and purging change the system database and normally require sudo (or a root shell). Keep the archive in a directory you can read, and use an explicit relative path such as ./package_version_arch.deb so dpkg treats it as a file rather than a package name to look up.

Inspect a .deb archive before installing it

A Debian archive contains control metadata and a filesystem payload. dpkg-deb reads the archive without installing it, which lets you check its identity and the paths it will place on the server.

Read control metadata

dpkg-deb --info ./package_version_arch.deb

This displays fields such as the package name, version, architecture, dependencies, and maintainer metadata. Verify that the name, version, release, and architecture match the software you intended to deploy.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

List the payload

dpkg-deb --contents ./package_version_arch.deb

Review the paths before installation, especially for a package that adds executables, systemd units, configuration under /etc, data under /var, or files that could overlap an existing installation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Consider provenance separately from format

A filename ending in .deb does not prove that the package is trustworthy. Apply your organization’s repository, vendor-signature, checksum, and change-control process. The archive inspection commands show what the file declares and contains; they do not establish that its publisher or contents are safe.

Install a local package with dpkg

For a local archive, the standard operation is:

sudo dpkg --install ./package_version_arch.deb

The short equivalent is:

sudo dpkg -i ./package_version_arch.deb

dpkg works on the archive you provide. It does not normally download a missing dependency set from repositories. A successful unpack can therefore be followed by a dependency or configuration error if required packages are absent.

A careful installation sequence

  1. Identify the host and architecture. Run cat /etc/os-release and dpkg --print-architecture.
  2. Inspect the archive. Run dpkg-deb --info and dpkg-deb --contents against the exact file you plan to use.
  3. Install the archive. Run sudo dpkg --install ./package_version_arch.deb from the directory containing it, or provide an absolute path.
  4. Read the complete output. Note dependency errors, maintainer-script failures, or messages saying that a package is unpacked but not configured.
  5. Make dependencies available through apt. Use your configured repositories and approved package source to obtain missing packages.
  6. Finish pending configuration. Run sudo dpkg --configure -a after the dependency situation is resolved.
  7. Verify the installed record. Query the package with dpkg-query and inspect any service or application checks required by your change procedure.

Fix an interrupted or partially configured transaction

Power loss, a terminated maintenance session, a failed maintainer script, or unavailable dependencies can leave packages unpacked and waiting for configuration. The recovery command is:

sudo dpkg --configure -a

The -a option means all packages that are unpacked but require configuration. dpkg runs their pending configuration steps in the order recorded in its database. Run this only after making required dependencies available; otherwise the same dependency errors can recur.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

When configuration still fails

  • Read the first dependency or maintainer-script error rather than focusing only on the final summary line.
  • Check the package’s metadata with dpkg-query -s package-name and inspect the transaction log at /var/log/dpkg.log.
  • Confirm that the required package names and versions are available from your configured repositories.
  • After correcting the underlying issue, run sudo dpkg --configure -a again.
  • Do not delete files from the dpkg database to silence an error. The database is the record used by package-management tools and must remain internally consistent.

Inspect installed packages with dpkg-query

dpkg-query is the practical interface for asking the dpkg database about package status, versions, metadata, installed paths, and file ownership.

Task Command What it shows
List matching package records dpkg-query -l 'package-pattern*' Status lines for packages matching the quoted pattern
Get package and version dpkg-query -W package-name The package’s registered name and version
Produce script-friendly output dpkg-query -W -f='${binary:Package}t${Version}t${Status}n' package-name Package name, version, and full status fields separated by tabs
Read package metadata dpkg-query -s package-name Description, dependencies, architecture, status, and other control fields
List files installed by a package dpkg-query -L package-name Paths recorded as belonging to that installed package
Find the package owning a path dpkg-query -S /usr/bin/example The installed package record that owns the exact path

Quote shell patterns. For example, dpkg-query -l 'libc6*' passes the wildcard to dpkg-query; without quotes, the shell may expand it against filenames in the current directory before dpkg-query receives it.

Use a human-oriented audit

dpkg --audit

This reports packages that are only partly installed or otherwise require attention. Use it alongside the individual package query and the log rather than treating an empty result as a complete application-health check.

Interpret dpkg -l status columns

The output from dpkg-query -l includes a compact status code. Its first character records the desired action, the second records the package’s current state, and the third records an error condition. Normal installed entries commonly begin with ii. An i followed by U, or an uppercase/error indicator in the third position, deserves investigation because the package may be unpacked but not configured or may have another recorded problem. Use the full status from dpkg-query -s to understand the specific record.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Remove a package or purge it completely

Remove while retaining configuration

sudo dpkg --remove package-name

--remove uninstalls the package’s installed program files while retaining its configuration files. Keeping configuration under paths such as /etc can make a rollback or later reinstall easier and can preserve evidence needed for troubleshooting.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

Purge package configuration

sudo dpkg --purge package-name

--purge removes the package and its registered configuration as part of the purge operation. Treat this as irreversible from the package manager’s perspective: export or back up settings you may need before purging.

Check service impact first

Package removal invokes package-specific maintainer scripts. Those scripts can stop services, remove users or groups, alter alternatives, or perform other cleanup. Review the package’s role on the server, schedule a maintenance window when appropriate, and verify dependent applications after the operation.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Find installed files and their owning package

To see every path recorded for an installed package:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
dpkg-query -L package-name

To identify which installed package owns a particular path:

dpkg-query -S /usr/bin/example

Use the exact path first. If a command is found through PATH, resolve its actual location with the shell’s normal inspection tools, then pass that path to dpkg-query -S. A path created after installation, generated at runtime, or supplied by an unmanaged source may have no owner in the dpkg database.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

Use the dpkg database and log for troubleshooting

The package status database is under /var/lib/dpkg. The principal status file is:

/var/lib/dpkg/status

The default dpkg transaction log is:

/var/log/dpkg.log

Inspect their presence and recent activity with:

ls -l /var/lib/dpkg/status /var/log/dpkg.log
tail -n 100 /var/log/dpkg.log

Administrative directories and logging can be configured differently on a particular system, so treat these as the defaults. The log records package actions and is especially useful for establishing what happened immediately before a failed configuration or removal.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the right command for the job

Goal Command Important limitation or consequence
Inspect an archive without installing dpkg-deb --info or dpkg-deb --contents Shows declared metadata or payload paths; changes nothing
Install a local archive sudo dpkg --install ./file.deb Uses the supplied file and does not resolve missing dependencies from repositories
Complete pending configuration sudo dpkg --configure -a Requires dependencies and any other prerequisites to be available
Check package status dpkg-query -s package-name Reports the database record, not whether the application’s service is responding
List package files dpkg-query -L package-name Lists paths registered by the package, not every runtime-generated file
Find file ownership dpkg-query -S /path/to/file Works for paths known to the installed dpkg database
Remove but keep configuration sudo dpkg --remove package-name Configuration files remain
Remove package and configuration sudo dpkg --purge package-name Configuration cleanup may eliminate settings needed for rollback

Common failure cases and recovery paths

“Dependency problems—leaving unconfigured”

The archive was processed, but one or more required packages are unavailable or at an unsuitable version. Use apt and your approved repositories to make those dependencies available, then run sudo dpkg --configure -a. Query the affected package with dpkg-query -s package-name to confirm whether it is installed, unpacked, or configured.

“dpkg was interrupted” or a pending transaction

Start with sudo dpkg --configure -a. If it reports a new, specific error, resolve that error rather than repeatedly rerunning the command. Check /var/log/dpkg.log for the operation that was in progress and use dpkg --audit to find other incomplete package records.

The archive will not install

  • Run dpkg-deb --info ./file.deb and compare the declared architecture with dpkg --print-architecture.
  • Check that the path is correct and that the file is readable.
  • Verify that the package targets the host’s Debian release and required versions.
  • Inspect the archive contents for unexpected paths before trying again.

A file is present but has no package owner

dpkg-query -S searches the installed database. A manually copied binary, a generated file, or a file installed by a tool outside dpkg will not necessarily have an owner record. Check the exact path and distinguish unmanaged files from files that were removed from the package record.

Removal affects a running service

Stop or drain the service according to your operational procedure before removing the package, and confirm dependencies and configuration backups. Maintainer scripts can perform service actions during removal; do not assume that deleting only the executable leaves the service unaffected.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Operational habits for reliable server use

  • Record the exact archive filename, version, architecture, and source used for a change.
  • Inspect metadata and contents before installation, particularly for packages obtained outside a repository.
  • Prefer apt-managed workflows when repository downloads and dependency resolution are required.
  • Run one package transaction at a time on production systems and retain the command output in the change record.
  • Use dpkg-query -W or the formatted query to capture the resulting version and status.
  • Keep configuration when you may need rollback; purge only after confirming that the settings are no longer needed.
  • Review /var/log/dpkg.log and /var/lib/dpkg/status before attempting invasive recovery.
  • Do not edit or delete dpkg database files manually unless you are following a documented, distribution-specific recovery procedure.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.