Debian’s aptitude command is, according to their documentation, the preferred program for package management. I use Ubuntu for my work machine and servers and have found aptitude to be easy to understand and use, as well as reliable.
see also: Aptitude vs Apt-get Comparison
Unlike apt-get, aptitude offers a full-screen (or full-window more likely) mode that can be used to interactively manage packages on a Debian or Ubuntu system. As is often the case, a combination of command line operation and an interactive utility prove to be very attractive and useful.
You might use command line mode most often, to install, remove and upgrade packages, and sometimes use the interactive mode to check the status of your system and mark packages to manage how particular packages are dealt with.
To start in interactive mode, simply enter aptitide, with no subcommands:
note: You do not need to sudo aptitude because, in interactive mode, it will prompt you and run sudo itself, if needed. Oh, the convenience!
Right away, you will see the interactive mode user interface:
The interactive interface includes drop-down menus at the top of the display. These are accessed with control-r or F10. Many of the of the commands available have a shortcut command key available, listed on the right side of the menu choice.
A full list of menu commands can be found here: http://algebraicthunk.net/~dburrows/projects/aptitude/doc/en/ch02s01s02.html
Packages are shown in groups, organized by the following categories:
|New packages||Packages that have been added since the list of new packages has been cleared (with the f command).|
|Installed packages||Packages that are installed on the computer.|
|Not installed packages||Packages that are not installed on the computer.|
|Obsolete and locally created packages||Packages that are installed on the computer, but not available from an apt source.|
|Virtual packages||Pseudonymous for other packages for compatibility or convenience.|
|Tasks||Groups of packages that offer an easy means to install groups of packages for some purpose.|
While the user interface is pretty well designed, it can be tricky to use because a variety of single letter codes are displayed and commands are entered via arcane single letter commands.
Navigation command keys
|F10 or control-t||Show the drop-down menu|
|+/- keys||Mark a package to be installed, updated or removed|
|g key*||Go forward: preview/confirm actions|
|q key*||Go back: quit|
* The q command quits the current operation and goes back to the previous mode. When at the top level, the q command quits the program. In general, the g goes forward and the q goes back.
- press u to update local list of available packages
- press U to mark upgradable packages
- press g to review pending actions (modify if desired*)
- press g (again) to start the process
Press g twice? Yes, the first time results in a list of packages that will be processed and the second time completes the action. This gives you a chance to review the changes before proceeding.
If you’ve erred, you can select ‘Cancel pending actions’ in the ‘Actions’ menu.
*When reviewing pending actions:
- a explicitly accepts an action (press it again to un-accept).
- r rejects a pending action.
- g again goes ahead with pending actions.
Use control-t for the drop-down menu to see all available actions. All of these commands are found in the Actions drop-down menu.
|shortcut key||item in Action menu||action|
|g||Install/remove packages||Show preview, or if preview visiable, perform actions|
|u||Update package list||Update local package list from Internet sources|
|U||Mark Upgradable||Flag upgradable packages|
|f||Forget new packages||Clear “new” packages list|
Common package commands
These commands are found in the Package drop-down menu.
|shortcut key||item in Action menu||action|
|+||Install||Marks package for installation|
|-||Remove||Marks package for removal|
|i||Cycle Package Information||Changes information displayed for selected package|
Current state flags
These flags appear in the first column of a table of packages when you’ve drilled down in one of the categories.
|i||Package is installed and all its dependencies are satisfied.|
|c||Package was removed, but its configuration files are still present.|
|p||Package and all its configuration files were removed, or the package was never installed.|
|v||Package is virtual.|
|B||Package has broken dependencies.|
|u||Package has been unpacked but not configured.|
|C||Half-configured: the package’s configuration was interrupted.|
|H||Half-installed: the package’s installation was interrupted.|
Position of the Current State and Action flags in the Package lists:
These flags appear right after the current state flag in column one of displayed packages when you’ve given a command to make an alteration. One or more action flags will appear.
|i||Package will be installed.|
|u||Package will be upgraded.|
|d||Package will be deleted: it will be removed, but its configuration files will remain on the system.|
|p||Package will be purged: it and its configuration files will be removed.|
|h||Package will be held back: it will be kept at its current version, even if a newer version becomes available, until the hold is cancelled.|
|F||An upgrade of the package has been forbidden.|
|r||Package will be reinstalled.|
|B||Package is broken: some of its dependencies will not be satisfied. aptitude will not allow you to install, remove, or upgrade anything while you have broken packages.|