Page Content

Tutorials

Linux Package Management Commands: APT, DNF, And YUM

Linux Package Management Commands

Managing software on Linux might feel like learning a new language, but it’s actually more like using different dialects of the same tongue. Whether you are on Ubuntu, Fedora, or RHEL, the logic remains the same: you ask a “Package Manager” to fetch, install, or delete software from a central library called a repository.

The three major players in the Linux world are broken down here.

Linux Package Management Commands
Image Credit To Napkin.AI

APT: The Debian & Ubuntu Standard

APT (Advanced Package Tool) is the most widely used package manager globally. It is famous for its simple syntax and its ability to handle complex “dependencies,” the extra bits of software a program needs to function.

Apt commands Linux

CategoryCommandDescription
Maintenancesudo apt updateRefreshes the local database of available packages from the repositories.
Upgradingsudo apt upgradeInstalls available updates for all currently installed packages.
Upgradingsudo apt full-upgradePerforms an upgrade but can also remove packages if necessary to resolve conflicts.
Installationsudo apt install <package>Downloads and installs a specific package along with its dependencies.
Removalsudo apt remove <package>Uninstalls a package but keeps its configuration files intact.
Removalsudo apt purge <package>Completely removes a package including all its configuration files.
Cleanupsudo apt autoremoveRemoves packages that were installed as dependencies but are no longer needed.
Cleanupsudo apt cleanClears out the local cache of downloaded package files (.deb files).
Searchapt search <keyword>Searches the descriptions of all available packages for a specific term.
Informationapt show <package>Displays detailed information about a package (version, size, dependencies).
Listingapt list --installedLists every package currently installed on your system.
Completely removes a package, including all its configuration files.apt list --upgradableShows a list of all packages that have an update available.

How the Process Works

Understanding the flow of package management helps prevent errors. Usually, the workflow follows a specific cycle:

  1. Update: You sync your local list with the server.
  2. Install/Upgrade: The manager calculates which files are needed.
  3. Resolve: The manager automatically downloads “dependencies” (helper apps).
  4. Configure: The software is unpacked and set up on your drive.

DNF: The Modern Powerhouse (Fedora)

DNF (Dandified YUM) replaced the aging YUM in Fedora 22. It was designed to be faster and use less memory while providing better feedback when a conflict occurs.

If APT is the reliable workhorse of the Debian world, DNF (Dandified YUM) is the high-performance engine of the Fedora and RHEL ecosystems. It was built to solve the performance bottlenecks of the older YUM manager, offering better dependency resolution and a more efficient memory footprint.

When using DNF, you will almost always need to use sudo it for any command that modifies the system (installing, removing, or updating).

Also read about What Are The Runlevels In Linux? & Common Systemd Targets

DNF Commands Linux

CategoryCommandDescription
Maintenancesudo dnf check-updateChecks for available updates without actually downloading them.
Upgradingsudo dnf upgradeDownloads and installs all available updates for the system.
Installationsudo dnf install <package>Installs a specific package and all required dependencies.
Removalsudo dnf remove <package>Uninstalls a package and removes its unneeded dependencies.
Reinstallationsudo dnf reinstall <package>Reinstalls a currently installed package (useful for fixing corrupted files).
Searchdnf search <keyword>Searches package names and summaries for the specified keyword.
Informationdnf info <package>Provides detailed information (version, size, repo) about a package.
Listingdnf list installedLists every package currently installed on the system.
Listingdnf list availableLists all packages in the enabled repositories that are not yet installed.
Historydnf historyDisplays a list of all previous DNF transactions (installs, updates, etc.).
Rollbacksudo dnf history undo <ID>Reverts a specific transaction using its ID from the history list.
Cleanupsudo dnf clean allRemoves all cached package data and temporary files to save space.
Groupssudo dnf groupinstall "<group>"Installs a collection of related packages (e.g., “Development Tools”).

DNF is particularly smart about “transaction history,” allowing you to undo an installation easily if it breaks your system.

Why DNF is “Dandified”

DNF introduced several features that make it feel more modern than its predecessors:

  1. Strict Dependency Resolution: It uses a state-of-the-art “satisfiability” (libsolv) algorithm to ensure that installing one program doesn’t accidentally break another.
  2. Transaction History: One of DNF’s best features is dnf history. If an update causes a problem, you can literally “undo” the last action to return your system to its previous state.
  3. Automatic Cleanup: Unlike APT, which often requires a separate autoremove command, DNF is generally better at cleaning up orphaned dependencies during the initial removal process.

YUM: The Enterprise Veteran (RHEL)

For decades, YUM (Yellowdog Updater, Modified) has been the backbone of Red Hat Enterprise Linux (RHEL), CentOS, and Amazon Linux. While newer versions of RHEL (8 and 9) use DNF as the default engine, yum remains the most recognized command in the enterprise world.

Because YUM handles system-wide software, you must prefix most commands with sudo to execute them with administrative privileges.

Also read about What Is Linux Mint? And Why Choose Mint Over Ubuntu? Explain

YUM Commands Linux

CategoryCommandDescription
Maintenancesudo yum check-updateLists all packages that have available updates without installing them.
Upgradingsudo yum updateUpdates all currently installed packages to their latest versions.
Installationsudo yum install <package>Downloads and installs a specific package and its dependencies.
Removalsudo yum remove <package>Uninstalls a package from the system.
Searchyum search <keyword>Searches the names and summaries of available packages for a match.
Informationyum info <package>Displays version, architecture, and description for a specific package.
Listingyum list installedDisplays a complete list of every package currently on your system.
Listingyum list availableShows all packages in your enabled repositories that you haven’t installed yet.
Historyyum historyShows a numbered list of past transactions (installs, updates, etc.).
Reversesudo yum history undo <ID>Reverts a specific transaction using the ID from the history list.
Dependencyyum deplist <package>Shows a detailed list of every library and file a package depends on.
Cleanupsudo yum clean allClears the cached package files and headers to free up disk space.
Providingyum provides <file_path>Finds which package contains a specific file or command.

The Architecture of YUM

YUM operates by communicating with remote “Repositories” (Repos). When you type an install command, YUM performs a multi-step process to ensure your system remains stable.

  1. Metadata Sync: YUM downloads a small database of what the server has.
  2. Dependency Calculation: It checks if the new software needs other libraries (like libc or openssl).
  3. Transaction Check: It ensures the new software won’t break existing programs.
  4. Execution: It downloads the .rpm files and installs them.

Key Differences at a Glance

If you’re jumping between systems, remember this shorthand:

  • Ubuntu/Debian (APT): Uses .deb files. Known for being extremely stable and having the largest community support.
  • Fedora/RHEL (DNF/YUM): Uses .rpm files. Known for enterprise-grade security and being the standard in corporate data centers.

The “Sudo” Requirement

Because these commands change the core files of your computer, they require root privileges. That is why almost every command starts with sudo (SuperUser DO). Without it, the system will politely (or bluntly) tell you that you don’t have permission to change things.

Also read about Linux Mint Installation Process Step By Step For Beginners

Hemavathi
Hemavathihttps://govindhtech.com/
Myself Hemavathi graduated in 2018, working as Content writer at Govindtech Solutions. Passionate at Tech News & latest technologies. Desire to improve skills in Tech writing.
Index