In this tutorial on Linux aptitude, 67 of 100, below find a 3-4 minute introductory video, a text-based tutorial and all of the code examples from the video.
Linux aptitude Command Summary with Examples (4:00)
Video Script
The Command and Why You Need It
Our sixty-seventh word, or command to memorize is
aptitude from our category
System.
aptitude allows you to manage software
packages.
Common Linux aptitude Options
-options
description
-h,
--help
Print help screen
-d
Download archives only
-y
Assume yes to queries
Recall from the last three videos on
dpkg,
apt-get and
apt-cache, we've been reviewing
options for evaluating and installing sotfware packages, and here we'll
conclude with a comprehensive interactive offering.
Before we start, it helps to think of commands as mini programs and
most follow this structure:
command -option(s) argument(s).
The aptitude command has
21 options and the argument is typically a software
package name. There are also, 23, let's call them sub-commands or
actions. As an example one may be entered like this:
aptitude [-options] install package name.
Like most commands, help is available with double-dash
--help. The
-d option downloads packages without
installing, and -y says 'yes' to
queries (accepting the default).
Make note, separate commands do apply to two types of Linux
distributions, Debian-style is aptitude,
here, and for Fedora it's yum.
So why is aptitude an important command?
Well, apt-get and
aptitude are similar except
aptitude's interactive interface is there for you to evaluate.
And now you know how to do that.
Demonstration
Okay, the best way to embed this in your memory is by typing in your
own terminal window.
Find this on your Mac using a program called Terminal. On Linux use
Terminal or Konsole, and currently Microsoft is adding this
functionality to Windows.
Here we go. Start by kicking help right in to
less using a pipe
| from the last video.
$ aptitude --help | less
aptitude 0.6.11
Usage: aptitude [-S fname] [-u|-i]
aptitude [options] <action> ...
Actions (if none is specified, aptitude will enter interactive mode):
install - Install/upgrade packages.
remove - Remove packages.
purge - Remove packages and their configuration files.
hold - Place packages on hold.
unhold - Cancel a hold command for a package.
markauto - Mark packages as having been automatically installed.
unmarkauto - Mark packages as having been manually installed.
forbid-version - Forbid aptitude from upgrading to a specific package version.
update - Download lists of new/upgradable packages.
safe-upgrade - Perform a safe upgrade.
full-upgrade - Perform an upgrade, possibly installing and removing packages.
build-dep - Install the build-dependencies of packages.
forget-new - Forget what packages are "new".
search - Search for a package by name and/or expression.
show - Display detailed information about a package.
versions - Displays the versions of specified packages.
clean - Erase downloaded package files.
autoclean - Erase old downloaded package files.
changelog - View a package's changelog.
download - Download the .deb file for a package.
reinstall - Download and (possibly) reinstall a currently installed package.
why - Show the manually installed packages that require a package, or
why one or more packages would require the given package.
why-not - Show the manually installed packages that lead to a conflict
with the given package, or why one or more packages would
lead to a conflict with the given package if installed.
Options:
-h This help text.
--no-gui Do not use the GTK GUI even if available.
-s Simulate actions, but do not actually perform them.
-d Only download packages, do not install or remove anything.
-P Always prompt for confirmation of actions.
-y Assume that the answer to simple yes/no questions is 'yes'.
-F format Specify a format for displaying search results; see the manual.
-O order Specify how search results should be sorted; see the manual.
-w width Specify the display width for formatting search results.
-f Aggressively try to fix broken packages.
-V Show which versions of packages are to be installed.
-D Show the dependencies of automatically changed packages.
-Z Show the change in installed size of each package.
-v Display extra information. (may be supplied multiple times).
-t [release] Set the release from which packages should be installed.
-q In command-line mode, suppress the incremental progress
indicators.
-o key=val Directly set the configuration option named 'key'.
--with(out)-recommends Specify whether or not to treat recommends as
strong dependencies.
-S fname Read the aptitude extended status info from fname.
-u Download new package lists on startup.
(terminal interface only)
-i Perform an install run on startup.
(terminal interface only)
This aptitude does not have Super Cow Powers.
And here sits 23 actions, I mentioned, and the 21 options. Please
review those later. (Hit q to quit).
Next, I'll do a search for the command
nano, a text editor, just as we did
in the previous video on apt-cache
and see if the results are similar to what we have over there.
$ aptitude search nano
p kiki-the-nano-bot - 3D puzzle game, mixing Sokoban and Kula-World
p kiki-the-nano-bot-data - Kiki the nano bot - game data
p libnanomsg-dev - nanomsg development files
p libnanomsg0 - high-performance implementation of scalability lib
p libnanomsg0-dbg - high-performance implementation of scalability lib
p libnanoxml2-java - small XML parser for Java
p libnanoxml2-java-doc - documentation for libnanoxml2-java
i nano - small, friendly text editor inspired by Pico
p nano-tiny - small, friendly text editor inspired by Pico - tin
p nanoblogger - Small weblog engine for the command line
p nanoblogger-extra - Nanoblogger plugins
p nanoc - static site generator written in Ruby
p nanoc-doc - static site generator written in Ruby - documentat
p nanopolish - consensus caller for nanopore sequencing data
p science-nanoscale-physics - Debian Science Nanoscale Physics packages
p science-nanoscale-physics-dev - Debian Science Nanoscale Physics development packa
And there they are, the same 16. Very good.
Okay, let's look at the change log, which shows updates to nano over
time. And this is a very long document.
$ aptitude changelog nano
Get: Changelog of nano
nano (2.2.6-3) unstable; urgency=medium
* The "Gürtel" release.
* Acknowledge 2.2.6-1.1 NMU (-2 was tagged, never uploaded... mysteries).
* Get rid of massively obsolete preinst upgrade code from 2004.
* Remove nano.desktop.
* Remove nano.README.Debian, the information included was now obsolete
or pointless.
* Canonicalise Vcs URLs.
* Use dpkg's buildflags.mk to enable hardening. Bump dpkg-dev Build-Dep
to >= 1.16.1~ accordingly (closes: #656133).
* Bump Standards-Version to 3.9.5.
* Add debian/upstream/signing-key.asc with Chris Allegreta's OpenPGP key.
* Move watch file to version 3, use http URL, add pgpsigurlmangle to
enable verification of tarball signatures and stop calling uupdate.
* Add manpage_escaping.patch to fix some escaping issues in nano.1 and
rnano.1. Thanks to Bjarni Ingi Gislason (closes: #662842, #726956).
* Add apt_transports.patch to add all currently supported apt methods to
the debian sources.list regexp.
* Shuffle build-* target deps and add an explicit build-indep target to
appease Lintian.
-- Jordi Mallach Wed, 16 Jul 2014 18:47:53 +0200
nano (2.2.6-2) unstable; urgency=low
* The "… a Picassent!" release.
* Add patches from Rodolphe Pelloux-Prayer to fix highlighting of
sources.list entries with tabs, and to support files in
/etc/apt/sources.list/*.list. Thanks! Closes: #614817.
* Bump Standards-Version to 3.9.2, no changes needed.
-- Jordi Mallach Wed, 06 Jul 2011 21:25:40 +0200
nano (2.2.6-1.1) unstable; urgency=low
* Non-maintainer upload.
* Ensure config.{sub,guess} are uptodate
-- Wookey Mon, 16 Dec 2013 22:26:27 +0000
nano (2.2.6-1) unstable; urgency=low
* The "Què vol que li diga? Que vosté és una sinvergüensa?" release.
* New upstream release.
* Apply auto.patch from Tiago Silva (and DEP-3ified by Colin Watson)
to support C/C++ 'auto' storage class specifier (closes: #605403).
-- Jordi Mallach Mon, 30 Aug 2010 19:35:50 +0200
nano (2.2.5-1) unstable; urgency=low
* The "Teulada" release.
* New upstream release.
- better behaviour when creating backup files on certain conditions.
- allow, via new command line option, to revert to old backup behaviour.
* Bump Standards-Version to 3.9.1 (no changes).
* Break, not Conflict, alpine-pico. Drop obsolete Conflicts from 2003.
* Rename nano-udeb's XC-Package-Type control field to Package-Type.
Bump dpkg-dev to 1.15.7.
-- Jordi Mallach Mon, 30 Aug 2010 18:05:29 +0200
nano (2.2.4-1) unstable; urgency=low
* The "905€" release.
* New upstream release.
- fixes minor security issues: symlink attack (CVE-2010-1160)
and ownership of arbitrary files (CVE-2010-1161). Closes: #577817.
-- Jordi Mallach Thu, 15 Apr 2010 19:26:23 +0200
nano (2.2.3-1) unstable; urgency=low
* The "Polop" release.
* New upstream release.
* Drop Build-Depends on groff; it was only needed to rebuild the
modified manpages.
* Nearly three years late, alpine-pico is finally playing the
update-alternatives game and can now coexist with nano. Update
our conflict accordingly. Thanks, Asheesh!
-- Jordi Mallach Fri, 12 Feb 2010 02:49:13 +0100
nano (2.2.2-1) unstable; urgency=low
* The "Cabanyal" release.
* New upstream release.
* Switch to dpkg source 3.0 (quilt). Remove quilt patching support and
README.source from the packaging, and drop quilt from Build-Depends.
-- Jordi Mallach Wed, 20 Jan 2010 00:18:38 +0100
nano (2.2.1-1) unstable; urgency=low
* The "Don Carlos" release.
* New upstream release.
* Remove obsolete patch 01_manpage_hyphens, fixed upstream.
-- Jordi Mallach Tue, 22 Dec 2009 19:34:49 +0100
nano (2.2.0-1) unstable; urgency=low
* The "Televisió Sense Fronteres" release.
* New upstream stable release!
* Remove patch 10_tinybuildfix, applied upstream.
* Update 01_manpage_hyphens, as it's been applied only partially upstream.
* Remove French manpages from nano, until they are back in sync with the
original versions (§12.1, Policy 3.8.3).
-- Jordi Mallach Tue, 01 Dec 2009 20:59:14 +0100
nano (2.1.99pre2-1) unstable; urgency=low
* The "Molt Poc Honorable" release.
* New upstream prerelease.
- fixes a cascade of "Closecode = -1" messages when opening multiple
buffers (closes: #551716).
- fixes handling of undo and casesensitive options in rcfiles
(closes: #558223)
* Apply patch #6993 from Savannah to fix builds of nano-tiny (thanks, DLR).
-- Jordi Mallach Fri, 27 Nov 2009 23:26:24 +0100
nano (2.1.99pre1-1) unstable; urgency=low
* The "Ferraris" release.
* New upstream prerelease.
* Remove empty /usr/share/nano from nano-tiny.
* Drop 10_browser_floating_point_exception.patch, obsolete.
-- Jordi Mallach Mon, 16 Nov 2009 14:05:28 +0100
nano (2.1.11-3) unstable; urgency=low
* The "Caja Madrid" release.
* Throw away html manpages, on both nano and nano-tiny. Fixes a
file conflict between both (closes: #553380).
* Fix, again, the install path for the nanorc example.
* Use upstream's fix for the browser floating point exception.
-- Jordi Mallach Fri, 30 Oct 2009 19:35:28 +0100
nano (2.1.11-2) unstable; urgency=low
* The "Ric Costa" release.
* Upload 2.1 to unstable, as upstream says a stable 2.2 release will
happen soon.
* Make nano depend on dpkg (>= 1.15.4) | install-info for the install-info
transition.
* Add dependencies on ${misc:Depends} for all packages.
* Bump Standards-Version to 3.8.3.
* Add 10_browser_floating_point_exception.patch to the series patch so it
really gets applied. Thanks again to Paul Wise (closes: #496008).
* Update 01_manpage_hyphens.patch to fix newly introduced unescaped
minus signs.
* Add descriptions to all patches according to DEP-3.
* Remove --enable-all from configure call, as it does nothing.
-- Jordi Mallach Wed, 28 Oct 2009 19:20:22 +0100
nano (2.1.11-1) experimental; urgency=low
* The "Socialistes Valencians" release.
* New upstream development release.
* Resynchronise nanorc with sample.nanorc, which now includes the
undo and soft options.
-- Jordi Mallach Wed, 16 Sep 2009 21:04:31 +0200
nano (2.1.10-1) experimental; urgency=low
* The "Una pastuqui importante" release.
* New upstream development release (closes: #522295).
- includes PHP syntax highlighting (closes: #477186).
(1,418 lines trimmed)
I'm showing the history of changes. Very good. It does take a few
seconds to get that information.
And last, here's a quick peek at the interactive view, for you to review
later.
$ aptitude
Actions Undo Package Resolver Search Options Views Help
C-T: Menu ?: Help q: Quit u: Update g: Download/Install/Remove Pkgs
aptitude 0.6.11
--- Security Updates (1)
--- Upgradable Packages (1)
--- Installed Packages (446)
--- Not Installed Packages (43945)
--- Virtual Packages (5279)
Security updates for these packages are available from security.debian.org.
This group contains 1 package.
A Final Tip
Okay now you know how to use aptitude.
And you know the syntax for commands, options and arguments.
One last tip about the aptitude
command. So FYI, some (Linux) distributions default to include either
apt-get/apt-cache, that combo, or
aptitude, but not both. So check that
out on your system.
Okay, thanks for visiting today. I hope this was a helpful
introduction to the aptitude command.
Learn More About The Series
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the
categories and a Q&A section, visit: