04. Commands with aptitude

Want a more user-friendly interface to managing your packages? No problem! We can do most all commands performed with apt-get and apt-cache with the aptitude interface. This uses a menu-driven, text-based application ran within the terminal, and serves as a front-end interface to the APT tool. Most commands are run with a single, lowercase letters.

Launching aptitude

To launch aptitude, simply type aptitude. You may need to install it by typing sudo apt-get install aptitude.

Aptitude command on Linux Command line

You'll first notice that the display is split into two panels - the top displaying packages, and the bottom describing the highlighted region.

Basic commands

Here is a list of the most basic commands to get you started:

?
Help
arrow keys
Navigation
+
Install/Update
-
Remove
u
Upgrade
g
Preview and confirm actions
q
Quit
a
Accept an action
r
Reject an action

Updating the cache

Simply hit the u key to update the cache.

Installing packages

  1. Hover over the Not Installed Packages section.
  2. Move into the folder by pressing the ENTER key.
  3. Position your cursor over to the package you want and press the + key.
  4. Package entry will turn green if successfully marked for installation.
  5. Press g to get a list of package actions.
  6. Press g again to download and install the package.

Removing packages

  1. Navigate to the installed packages category by using the keyboard arrow keys and hit ENTER.
  2. Highlight the desired package and press -.
  3. Package entry will turn pink if it has been successfully marked for removal.
  4. Press g to see a list of package actions, and press g again to remove the package.

Upgrading packages

  1. Press the U key to mark all packages with updates.
  2. Press g and you'll obtain a list of package actions.
  3. Press g again to download and install the new updated package contents.
  4. Press ENTER to return to the menu.

Package attributes

i
Installed package.
c
A package that is not installed, but its configuration is on system.
p
Purged from system.
v
Virtual package.
B
Broken package, meaning you have not installed its dependencies.
u
Unpacked files, but package not yet configured.
C
Half-configured, configuration failed and rquires to fix.
H
Half-installed, removal failed and requires fix.

Exiting

To exit the interface, press q and confirm.

Using aptitude on the command line

Aptitude can also perform several command line tasks that are identical to apt-get.

install
Install one or more packages.
update
Updates the list of available packages from apt sources.
safe-upgrade
Conservative about removing packages or installing new ones. so it may fail.
full-upgrade
Less conservative. Removes and installs packages as necessary. May break software in the process.
search
Searches database for packages matching specified name.
show
Displays detailed information about on or more packages.
clean
Removes all previously downloaded .deb files from the package cache.
autoclean
Removes already downloaded packages that are no longer available.
clean
Removes all downloaded packages.
help
Display help.

Want to avoid becoming a code monkey?

Clean Code

Want to avoid becoming a code monkey? Try Good Practice

Software expert Robert C. Martin presents a revolutionary paradigm with Clean Code: A Handbook of Agile Software Craftsmanship. Martin has teamed up with his colleagues from Object Mentor to distill their best agile practice of cleaning code "on the fly" into a book that will instill within you the values of a software craftsman and make you a better programmer.

$ Check price
49.9949.99Amazon 4.5 logo(427+ reviews)

More Good Practice resources

Take your Linux skills to the next level!

System Admin Handbook

Take your Linux skills to the next level! Try Linux & UNIX

This book approaches system administration in a practical way and is an invaluable reference for both new administrators and experienced professionals. It details best practices for every facet of system administration, including storage management, network design and administration, email, web hosting, scripting, and much more.

$ Check price
74.9974.99Amazon 4.5 logo(142+ reviews)

More Linux & UNIX resources

Ad