LOGO

APT vs apt-get: Simplified Package Management

November 27, 2015
APT vs apt-get: Simplified Package Management

APT and the Evolution of Package Management

The Advanced Package Tool, or APT, originating from the Debian project, provides a system for managing software packages. It achieves this through the coordinated use of several distinct tools, each designed for specific functions.

Historically, effectively utilizing APT required familiarity with a range of command structures. Users needed to learn commands like apt-get, apt-cache, and apt-config, among others, to access its complete capabilities.

Addressing the Challenges of Package Dependencies

APT was initially developed to address significant issues in package management. A primary goal was to eliminate the frustrating "dependency hell" that plagued early Linux-based operating systems.

However, APT now faces a different challenge, which can be termed "Dispersed Documentation Hell" (DDH). Information regarding APT is fragmented across various tools, and in some instances, like with the core 'apt' command, locating comprehensive documentation proves difficult.

The Rise of the 'apt' Command

For more than ten years, the majority of online tutorials and guides for Debian and Ubuntu systems have recommended using apt-get for package installation and removal.

This recommendation was accurate at the time, as the 'apt' command itself did not yet exist. However, due to the aforementioned documentation issues, many users remain unaware of its current availability.

Simplified Package Installation

Previously, installing a package typically involved the following command:

sudo apt-get install package

Now, this process can be streamlined with a simpler command:

sudo apt install package

Benefits of Using 'apt'

While some may contend that 'apt' and 'apt-get' function similarly, the removal of the hyphen in the command offers a noticeable improvement in usability.

Employing 'apt' can reduce the time spent typing and the overall number of keystrokes needed to complete the same task, contributing to a more efficient workflow.

Dispersed Documentation Hell (DDH)

A core issue surrounding APT documentation is its inconsistent availability. Depending on the search method and source consulted, relevant information may be difficult or impossible to locate.

Searching online via Google or DuckDuckGo for "apt documentation" typically yields one of three result types.

  • Documentation pertaining to the older apt-get command.
  • General introductory information about the APT system.
  • Results that are entirely unrelated to package management.

Adding terms like "linux", "ubuntu", or "debian" to the search query does not significantly improve the relevance of the results.

The Severity of the Problem

The extent of this Dispersed Documentation Hell (DDH) is considerable. Documentation from Debian.org, even if labeled as obsolete, is often encountered before any helpful resources specifically addressing the "apt" command itself.

Finding current, accurate documentation for the "apt" command can be surprisingly challenging, despite its widespread use.

This fragmented landscape necessitates a proactive approach to learning and utilizing APT effectively.

Man Pages

Man Pages serve as documentation resources accessible both on your computer and through online repositories.

The accuracy of locally stored entries is contingent upon your distribution's version. For instance, Ubuntu 15.10 features the most current man pages, while 14.04 does not, initially.

However, maintaining an updated Ubuntu 14.04 system through service pack installations will provide you with the latest documentation.

You can verify whether you possess the newest version of a man page using the following command:

man apt

Online vs. Local Man Pages

Conversely, searching for man pages online frequently yields older, introductory overviews.

Further investigation may reveal more recent versions, such as the Ubuntu 15.10 documentation, or conversely, outdated entries like the online 14.04 man page.

Therefore, local man pages, when kept current, often provide a more reliable source of information than those found through general online searches.

It's important to consider the source and version when consulting Man Pages to ensure accuracy.

Streamlining Package Management with APT

The following details the most practical options within the apt command, and the older commands they consolidate for improved efficiency.

  • apt install package(s)
    • Functions as a replacement for apt-get install package.
    • Also supersedes the process of navigating to the Downloads directory, utilizing dpkg -i application.deb, and subsequently resolving dependencies with apt-get -f install.
  • apt remove package(s)
    • Offers the same functionality as apt-get remove package.
  • apt search query
    • Provides an alternative to apt-cache search query.
  • apt show package(s)
    • Can be used instead of apt-cache show package(s).
  • apt update
    • Equivalent to running apt-get update.
  • apt upgrade
    • Replaces the functionality of apt-get upgrade.
  • apt list --installed
    • Serves as a substitute for dpkg --get-selections | grep -v deinstall.
    • Also functions like dpkg -l.
  • apt list --upgradable (sudo not required)
    • An alternative to apt-get -u upgrade --assume-no, which typically requires sudo privileges.
  • apt edit-sources
    • Simplifies modifying source lists, replacing commands like echo 'new line of text' | sudo tee -a /etc/apt/sources.list.
    • Also replaces direct editing with sudo nano /etc/apt/sources.list.

Update as of April 1, 2016: With Ubuntu 16.04, the Debian/Ubuntu implementation of the apt command gained additional capabilities.

  • apt autoremove
    • Functions as a replacement for apt-get autoremove.
  • apt purge package(s)
    • Offers the same functionality as apt-get purge package(s).

These additions further enhance the apt command's utility in managing software packages.

Enhancements to Simplicity in Linux Mint

Operating systems built upon Debian or Ubuntu foundations have recently incorporated updated versions of APT, enabling certain task simplifications. However, the Linux Mint development team initiated efforts to streamline APT several years prior.

Linux Mint developed a Python script, beginning in 2009, with the goal of maximizing both the utility and ease of use of APT. It is hoped that the Debian project will recognize the advantages of expanding APT’s functionality, allowing broader access to the simplified methods being pioneered by Mint.

The apt command possesses the potential for significant improvement, and it is anticipated that Debian will acknowledge this and fully realize apt’s capabilities.

Automatic Sudo Application

A notable decision made by Linux Mint in their script’s design was the elimination of the necessity for manual sudo usage. For instance, executing "apt install package" automatically prepends sudo when required, relieving the user from needing to remember which commands demand elevated privileges.

Useful Additional Options

The following list details the most valuable supplementary options available through the Linux Mint apt command, alongside the older commands they supersede. Please note that these enhancements are currently exclusive to Linux Mint users.

  • apt autoclean
    • Functions as a replacement for apt-get autoclean.
  • apt autoremove
    • Serves as an alternative to apt-get autoremove.
  • apt purge package(s)
    • Replaces apt-get remove --purge package(s).
  • apt depends package(s)
    • Offers the same functionality as apt-cache depends package(s).
  • apt rdepends package(s)
    • Functions identically to apt-rdepends package(s).
  • apt policy package(s)
    • Provides the same information as apt-cache policy package(s).
  • apt held
    • Equivalent to dpkg --get-selections | grep hold.
  • apt hold package
    • Replaces echo package hold | sudo dpkg --set-selections.
  • apt unhold package
    • Functions as a substitute for echo package install | sudo dpkg --set-selections.
  • apt download package (downloads the deb file of a package)
    • Replaces LC_ALL=C apt-cache depends package |grep -v "Conflicts:\|Replaces:"|awk '{print $NF}'|sed -e 's/[<>]//g'|xargs aptitude download -r.

Enhanced Package Management with APT

The apt command has streamlined numerous tasks related to package management via the command line on Linux, particularly within Debian-based distributions.

Linux Mint has proactively sought to refine this process, aiming to facilitate a smoother transition for the community to these updated methodologies.

A Missing Feature and a Community Contribution

Initially, a notable absence in Linux Mint's apt script was a direct replacement for the somewhat cumbersome add-apt-repository command.

To address this, a patch was developed to incorporate functionality equivalent to apt add-repository directly into the script.

This enhancement has been successfully accepted by the Linux Mint team and will be included in an upcoming release.

Benefits of the Update

  • Improved user experience through a more consistent command structure.
  • Simplified addition of new package sources.
  • Enhanced efficiency in managing software repositories.

The integration of this feature represents a positive step towards a more user-friendly and powerful package management system for Linux Mint users.

It demonstrates the value of community contributions in shaping the development of open-source software.

#APT#apt-get#package management#Debian#Ubuntu#command line