Skip to main content

Software management with APT and DPKG

By October 2, 2013September 12th, 2022No Comments

If you are new to Ubuntu but not new to Linux you may already be familiar with using RPM in your software management; if you are new to Linux you may be used to MSI files in Windows Systems. Ultimately, though, RPMs and MSI serve the same purpose, the files used in Ubuntu though are .DEB files and come from the Debian Package Management system.

As with an RPM based system though, very often we install software packages from network based repositories and this too is the case with Ubuntu. We would only use a .deb file if we had download it for install from a vendor website. The program dpkg can be used to install .deb files but more often we would use dpkg to view information about packages on our system .

  • dpkg -l | to list all packages installed
  • dpkg -L vim | to list all files that came with the package vim
  • dpkg -s vim | display status or full information for the vim package
  • dpkg -S /etc/at.deny | display the owning package of the specified file

To install software, typically, we will use repositories. This would be listed in the /etc/apt/sources.list files and would includes servers at Ubuntu. The commands to build up a list of software that can be installed or our cache we could use the command:

sudo apt-get update

This would write details of the packages available from the combined repositories through to the directory /var/cache/apt/archives. To configure a different apt cache location we could use the apt.conf file. Once we have populated the cache we can search for software using the command :

apt-cache search nmap


apt-cache search "Port Scanner"

To install the software we can then use

 sudo apt-get install nmap

If we needed to remove nmap then we could use:

sudo apt-get remove nmap

should we not want to be prompted to accept the installs or removals then use the -y option with the command,

sudo apt-get -y remove nmap.