Packages and backups

The dpkg command

Manages .deb packages directly: install them, list them or check which package a file belongs to.

Syntax

dpkg -l | dpkg -i paquete.deb | dpkg -S archivo

Most useful options

-lLists installed packages
-iInstalls a .deb
-LLists a package's files
-SSays which package a file belongs to

Copy-ready examples

$ dpkg -lInstalled packages
$ dpkg -S lsWhich package is ls from?

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • dpkg does not resolve dependencies: if something is missing, use apt install -f.

Related commands

FAQ

dpkg or apt?

apt is the friendly layer that uses dpkg underneath and resolves dependencies.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course