aptitude - Linux


Overview

aptitude is a text-based interface to the Debian GNU/Linux package system, including Ubuntu and other Debian-based distributions. It combines the functionality of other package management tools such as apt-get and apt-cache into a single, unified command. aptitude provides a user-friendly and terminal-based interface for managing packages (installing, upgrading, and removing software packages), as well as for resolving dependencies. It is most effective for routine package management tasks and troubleshooting dependency issues.

Syntax

The basic syntax for aptitude is as follows:

aptitude [options] [action]

Actions

  • install <package(s)>: Installs or upgrades packages.
  • remove <package(s)> | purge <package(s)>: Removes or purges packages.
  • update: Updates the list of known packages.
  • upgrade: Upgrades all upgradable packages.
  • full-upgrade: Performs an upgrade, possibly removing installed packages.
  • search <pattern>: Searches for a package by name or description.
  • show <package>: Displays detailed information about a package.

Options/Flags

  • -F <format>: Specify a custom output format.
  • -y, --assume-yes: Assume yes as an answer to all prompts.
  • -d, --download-only: Download packages but don’t install/upgrade them.
  • --purge-unused: Automatically remove unused packages.
  • -v, --verbose: Display more detailed output.
  • --safe-resolver: Use the safe dependency resolver.

Example of typical use cases:

  • Use -d to download updates in advance when you plan to install them later without internet access.
  • The --safe-resolver option is valuable when troubleshooting dependency conflicts.

Examples

  1. Updating Package Lists
    aptitude update
    
  2. Installing a New Package
    aptitude install vim
    
  3. Upgrading all Packages
    aptitude full-upgrade
    
  4. Searching for Packages Related to Apache
    aptitude search apache
    
  5. Displaying Detailed Information About a Package
    aptitude show nginx
    
  6. Removing a Package
    aptitude remove old-package
    

Common Issues

  • Broken Dependencies: Sometimes, installing or upgrading packages can lead to unmet dependencies. Use aptitude -f install to attempt fixing broken dependencies.
  • Package Conflicts: Use the --safe-resolver when typical installation fails due to conflicts between packages.
  • Disk Space Issues: Before performing upgrades, ensure there is sufficient disk space. Resolve by cleaning up with aptitude purge ~c.

Integration

Combine aptitude with other commands to perform advanced system maintenance tasks. For example:

# Update system and clean up downloaded package files
aptitude update && aptitude full-upgrade && aptitude clean
  • apt-get: More granular control over package management.
  • dpkg: Lower-level package management.
  • apt-cache: Searches the package cache.

For more information, visit the official APT tools documentation.

This manual should serve as a comprehensive guide for using aptitude effectively in a variety of system management scenarios.