Red Hat Enterprise Linux uses the RPM package format and utilizes RPM and YUM for package management. Ubuntu is a Debian-based Linux distribution and is freely available for use, with a comprehensive package management system. Ubuntu utilizes the .deb packaging format and tools for package management, such as apt and dpkg.
In this guide, you will learn
about the Ubuntu package management tools, a fundamental feature of the Ubuntu
system administration. You will learn how to use apt in Ubuntu for managing
packages, updating your system and installing software from repositories. You
will also learn how the dpkg command in Ubuntu helps you manually install and
manage .deb files. This will serve as a quick reference for when you learn how
to perform package management tasks in these systems.
Before learning how to use the APT and DPKG in the Ubuntu, it is helpful to understand the fundamentals of the Linux operating system. you are new to the Linux, read our beginner guide on What is Linux? An Introduction to Linux and Its Popular Distributions.
is a standard command-line tool in Debian-based Linux
distributions used for installing, deleting, updating, and upgrading software
packages and system-related components. APT interacts with software
repositories to download the packages and install them on the system,
automatically manages dependencies and ensures system stability. This guide
will help the system administrators understand the Ubuntu package
installation using APT and tracking of updates and upgrades of installed packages.
3. APT Search Package
If you are unsure about a package or want to explore available options then you can use the search feature in APT. It displays matching packages along with a brief description of each. As you can the description of postfix below.
4. APT Show Package
The apt show command displays detailed information about a specific package including its version, dependencies, maintainer and description.
sudo apt show postfix
The Package management in Linux is usually performed through the terminal. you are new to working with the Linux commands, check our tutorial on 10 Linux Basic Commands Every Beginner Should Know.
5. APT Update
The apt update command refreshes the information of package index by synchronizing from configured repositories. It ensures your system has the latest details about available packages before installation or upgrade.
sudo apt update
6. APT Upgrade
The apt upgrade command installs the latest version of packages that are already installed on the system. It makes comparison of installed packages with the updated package index and upgrades them if newer versions are available. This command upgrades existing packages but does not install new ones or remove existing packages.
To view the list of upgradable packages, use the following command:
sudo apt list --upgradable
7. APT Install
To install a package such as apache2, use the following command:
sudo apt install apache2
The installation process shows package information such as dependencies and required disk space. You can confirm the installation by pressing y or cancel it by pressing n.
When installing the software packages, files are placed in the different directories within the Linux filesystem. The filesystem structure will help you to manage the installed software more effectively. Read our guide on Linux Directory Structure and File System – Beginners to Pro Guide.
9. APT Full Upgrade
The apt full upgrade command upgrades all installed packages and automatically manages dependencies. It may remove existing packages or install new ones if necessary to complete the upgrade.
sudo apt full-upgrade
10. Add/Remove Repositories
To add a repository to the system, use the following command:
sudo add-apt-repository "deb https://dl.winehq.org/wine-builds/ubuntu/ $(lsb_release -cs) main"
Dpkg is a low-level package management tool used
in Debian based Linux distributions such as Ubuntu. It is used to install,
remove and manage individual .deb packages.
Unlike APT dpkg does not handle dependencies automatically or download packages from repositories. Due to its limited functionality, it is typically not used as the primary tool for package management.
Different Linux distributions use the different package management systems. For example, Red Hat based systems use the RPM and YUM or DNF. You can read this in our guide on RHEL 9 Package Management Guide: How to Install, Update & Remove Packages.
1. Display dpkg version
To check the installed version of dpkg, use the following command:
2. Dpkg Help
To view help information for the dpkg command, use the following:
sudo dpkg --help
for the available
options and switches to use for package management. 
3. Dpkg Install
To install a .deb package for example, chat-gpt.deb, use the following command:
sudo dpkg -i ChatGPT_1.1.0_linux_x86_64.deb ## or
sudo dpkg --install ChatGPT_1.1.0_linux_x86_64.deb 
4. Dpkg Status
The dpkg -s command displays detailed status information about a specific package including its installation status, version and dependencies.
#sudo dpkg -s zstd
Or
5. Dpkg List Files
To list the files owned by a package, use the following command:
#sudo dpkg -L zstd
Or
sudo dpkg --listfiles zstd
6. dpkg List Packages Concisely
The dpkg -l command lists all installed packages. You can also specify a package name to display details for a particular package.
#sudo dpkg -l zstd
Or
7. Architecture of dpkg
installs
The dpkg --print-architecture command shows the system’s architecture such as amd64 or arm64.
sudo dpkg --print-architecture 
8. dpkg unpack a package
The dpkg --unpack command extracts the contents of a .deb package without installing it. This step prepares only the package files but it does not configure or complete the installation.
sudo dpkg --unpack
flashplugin-installer_11.2.202.350ubuntu1_amd64.deb 
sudo
dpkg-reconfigure zstd
11. Get Package Selections
The dpkg --get-selections command lists all installed packages along with their installation status.
12. Remove Package
To remove a package, use the following command:
sudo dpkg -r zstd
Common APT and GPKG Commands
The following table summarizes the most commonly used APT and DPKG commands for package management in Ubuntu.
APT Commands
| Command | Purpose | Example |
|---|---|---|
apt help |
Display help and options | sudo apt help |
apt list |
List installed packages | sudo apt list |
apt search |
Search for packages | sudo apt search postfix |
apt show |
Show package details | sudo apt show postfix |
apt update |
Update package index | sudo apt update |
apt upgrade |
Upgrade installed packages | sudo apt upgrade |
apt full-upgrade |
Perform full system upgrade | sudo apt full-upgrade |
apt install |
Install a package | sudo apt install apache2 |
apt remove |
Remove a package | sudo apt remove apache2 |
add-apt-repository |
Add or remove repositories | sudo add-apt-repository repo |
DPKG Commands
| Command | Purpose | Example |
|---|---|---|
dpkg --version |
Display dpkg version | dpkg --version |
dpkg --help |
Show help information | dpkg --help |
dpkg -i |
Install .deb package | sudo dpkg -i package.deb |
dpkg -s |
Check package status | sudo dpkg -s zstd |
dpkg -L |
List files of a package | sudo dpkg -L zstd |
dpkg -l |
List installed packages | sudo dpkg -l |
dpkg --print-architecture |
Show system architecture | dpkg --print-architecture |
dpkg --unpack |
Unpack a package | sudo dpkg --unpack package.deb |
dpkg-reconfigure |
Reconfigure a package | sudo dpkg-reconfigure zstd |
dpkg --audit |
Check broken packages | sudo dpkg --audit |
dpkg --get-selections |
List package selections | sudo dpkg --get-selections |
dpkg -r |
Remove package (keep config) | sudo dpkg -r zstd |
dpkg -P |
Remove package with config | sudo dpkg -P zstd |
- Always run sudo apt update before installing
- Prefer apt over dpkg for automatic dependency handling
- Use dpkg only for local .deb files
- Regularly run sudo apt autoremove to clean unused packages
- Enable automatic security updates on production systems
The Software management is one of the core responsibilities of a Linux system administrator. Learn more about managing the user access and permissions in our tutorial on Managing Users and Groups in Linux – A Complete Guide for Beginners.
Ubuntu package management using APT and DPKG provides powerful tools for installing, updating, and maintaining software. As APT simplifies dependency management and system updates, DPKG offers low-level control for handling individual packages.
By understanding and using these tools effectively, administrators can maintain a stable, secure, and well-managed Linuxsystem.
Continue to visit seeklinux for more information and updates.
Author: Aqeel Anwar
Linux Engineers | DevOps | Security Enthusiasts
SeekLinux Team shares practical Linux tutorials, SSL/TLS certificate guides, commands and DevOps solutions. Our goal is to simplify system administration and help you master real-world server and security tasks.





















Post a Comment