aptitude

Table of Contents

1. Description

The aptitude manual can also be found locally at /usr/share/aptitude/README, describing long (?installed) and short (~i) forms and how to specify the output format using -F '%p' etc.

2. Output characters

The first character of each line indicates the current state of the package.

  • p No trace of the package exists on the system
  • c Package was deleted but its configuration files remains on the system
  • i Package is installed
  • v Package is virtual

The third character A means the package was automatically installed.

The output format can be modified with -F.

3. Explain why package_name should be installed

aptitude why <package_name>

4. List installed packages section

aptitude -F '%s' search '~i' | sort -u

5. List installed packages by origin

Search for installed packages from the Raspberry Pi Foundation origin, use apt-cache to find origins

aptitude search "?origin(Raspberry Pi Foundation) ?installed"

6. List installed packages by section

aptitude -F '%s' search "~i" | sort -u > .list
while read -r line; do echo " ---- section: $line ---- " && aptitude -F '%p' search "~i ?section($line)"; done < .list

6.1. List installed packages and their section

aptitude -F '%p|%s' search '~i'

6.2. Amount of installed packages from each section

aptitude -F '%s' search '~i' | sort | uniq -c | sort -n

6.3. List packages from section that are not installed

aptitude search '!~i ?section(fonts)'

7. Download and display the changelog of package_name

aptitude changelog package_name

8. List recommends packages that are not installed (packages recommended by one installed)

9. List reverse package_name dependencies chain (package not required by other packages)

aptitude search '?and(?installed, !?reverse-depends(~i))'

10. Related nodes

11. References