The package list can be heavily customized: how packages are displayed, how the package hierarchy is formed, how packages are sorted, and even how the display is organized are all open to change.
This section describes how to configure the contents and format of the package list, status line, and header line.
The format of each of these locations is defined by a
“format string”. A format string is a string of text
containing %
-escapes such as
%p
, %S
, and so on.
The resulting output is created by taking the text and
replacing the %
-escapes according to
their meanings (given below).
A %
-escape can either have a fixed
size, in which case it is always replaced by the same
amount of text (with extra space characters added to fill
it out as necessary), or it can be “expandable”, meaning
that it takes up the space that is not claimed by
fixed-size columns. If there are several expandable
columns, the extra space is divided evenly between them.
All %
-escapes come with a default size
and/or expandability. The size of a
%
-escape can be changed by writing it
between the %
and the character
identifying the escape; for instance,
%20V
generates the candidate version of the
package, 20 characters wide. Placing a question mark
(?
) between the %
and the character identifying the escape causes the
column's “basic” width to vary depending on
its content. Note that the resulting columns might not
line up vertically!
If you want a particular %
-escape to be
expandable, even though it normally has a fixed width,
place a pound sign (ie,
“#
”) immediately after it.
For instance, to display the candidate version of a
package, no matter how long it is, use the format string
%V#
. You can also place
#
after something that is not a
%
-escape; aptitude will
“expand” the text preceding the
#
by inserting extra spaces after it.
In summary, the syntax of a %
-escape is:
%
[width
][?
]code
[#
]
The configuration variables Aptitude::UI::Package-Display-Format
,
Aptitude::UI::Package-Status-Format
,
and Aptitude::UI::Package-Header-Format
define the default formats the package list, the header at
the top of the package list, and the status line below the
package list respectively.
The following %
-escapes are available
in format strings:
![]() | Note |
---|---|
Some of the descriptions below refer to “the package”. In the GUI, this is either the package being displayed or the currently selected package; in the command-line search, this is the package being displayed. |
Escape | Name | Default size | Expandable | Description |
---|---|---|---|---|
%% | Literal % | 1 | No | This is not really an escape; it simply inserts a percent sign into the output at the point at which it occurs. |
%# | Parameter Replacement | Variable | No |
In some circumstances, a display format string will
have “parameters”: for instance, in the
command-line search , the groups
matched by the search are used as parameters when
displaying the result. This format code will be
replaced by the parameter indicated by
number .
|
%a | Action Flag | 1 | No | A single-character flag summarizing any action to be performed on the package, as described in Figure 2.10, “Values of the “action” flag”. |
%A | Action | 10 | No | A somewhat more verbose description of the action to be performed on the package. |
%B | Broken Count | 12 | No |
If there are no broken packages, produces nothing.
Otherwise, produces a string such as
“Broken: 10 ”
describing the number of broken packages.
|
%c | Current State Flag | 1 | No | A single-character flag summarizing the current state of the package, as described in Figure 2.9, “Values of the “current state” flag”. |
%C | Current State | 11 | No | A more verbose description of the current state of the package. |
%d | Description | 40 | Yes | The package's short description. |
%D | Package Size | 6 | No | The size of the package file containing the package. |
%H | Hostname | 15 | No | The name of the computer on which aptitude is running. |
%i | Pin priority | 4 | No | Displays the highest priority assigned to a package version; for packages, displays the priority of the version which will be forced to be installed (if any). |
%I | Installed Size | 6 | No | The (estimated) amount of space the package takes up on disk. |
%m | Maintainer | 30 | Yes | The maintainer of the package. |
%M | Automatic Flag | 1 | No |
If the package is automatically installed, outputs
“A ”; otherwise,
outputs nothing.
|
%n | Program Version | The length of “0.4.3”. | No |
Outputs the version of the program, currently
“0.4.3 ”.
|
%N | Program Name | The length of the program name. | No |
Outputs the program name; usually
“aptitude ”.
|
%o | Download Size | 15 | No |
If no packages are going to be installed, outputs
nothing. Otherwise, outputs a string describing the
total size of all the package files which will be
installed (an estimate of how much needs to be
downloaded); for instance, “DL size:
1000B ”.
|
%p | Package Name | 30 | Yes | Outputs the name of the package. When a package is displayed in a tree context, the name of the package will be indented, if possible, according to its depth in the tree. |
%P | Priority | 9 | No | Outputs the priority of the package. |
%r | Reverse Depends Count | 2 | No | Outputs the approximate number of installed packages which depend upon the package. |
%R | Abbreviated Priority | 3 | No |
Outputs an abbreviated description of the package's
priority: for instance,
“Important ” becomes
“Imp ”.
|
%s | Section | 10 | No | Outputs the section of the package. |
%S | Trust Status | 1 | No | If the package is untrusted, displays the letter "U". |
%t | Archive | 10 | Yes | The archive in which the package is found. |
%T | Tagged | 1 | No |
Outputs “* ” if the
package is tagged, nothing
otherwise.[14]
|
%u | Disk Usage Change | 30 | No |
If the scheduled actions will alter the amount of
space used on the disk, outputs a description of the
change in disk space; for instance,
“Will use 100MB of disk
space. ”
|
%v | Current Version | 10 | No |
Outputs the currently installed version of the
package, or
<none> if the
package is not currently installed.
|
%V | Candidate Version | 10 | No |
Outputs the version of the package which would be
installed if +) were issued on the
package, or
<none> if the
package is not currently available.
| → (
%Z | Size Change | 7 | No | Outputs how much additional space will be used or how much space will be freed by installing, upgrading, or removing a package. |
The package hierarchy is generated by a
grouping policy: rules describing
how the hierarchy should be built. The grouping policy
describes a “pipeline” of rules; each rule
can discard packages, create sub-hierarchies in which
packages reside, or otherwise manipulate the tree. The
configuration items Aptitude::UI::Default-Grouping
and Aptitude::UI::Default-Preview-Grouping
set the grouping policies for newly created package lists
and preview screens, respectively. You can set the
grouping policy for the current
package list by pressing G.
The grouping policy is described by a comma-separated list
of rules:
.
Each rule1
,rule2
,...
rule
consists of the name
of the rule, possibly followed by arguments: for instance,
versions
or
section(subdir)
. Whether arguments are
required and how many arguments are required (or allowed)
depends on the type of rule.
Rules can be non-terminal or terminal. A non-terminal rule will process a package by generating some part of the hierarchy, then passing the package on to a later rule. A terminal rule, on the other hand, will also generate part of the tree (typically items corresponding to the package), but does not pass its package to a later rule. If no terminal rule is specified, aptitude will use the default rule, which is to create the standard “package items”.
action
Groups packages according to the action scheduled on them; packages that are not upgradable and will be unchanged are ignored. This is the grouping that is used in preview trees.
deps
This is a terminal rule.
Creates standard package items which can be expanded to reveal the dependencies of the package.
filter(pattern
)
Include only packages for which at least one version
matches pattern
.
If pattern
is
“missing”, no packages are discarded.
This is a backwards compatibility feature and may be
removed in the future.
firstchar
Groups packages based on the first character of their name.
hier
Groups packages according to an extra data file describing a “hierarchy” of packages.
pattern(pattern
[=>title
][, ...])
A customizable grouping policy. Each version of
every package is matched against the given
pattern
s. The first
match found is used to assign a
title
to the package;
packages are then grouped by their
title
. Strings of the
form \N
that occur in
title
will be replaced by
the Nth result of the match. If
title
is not present, it
is assumed to be \1
.
For instance, pattern(~m => \1)
will group packages according to their Maintainer
field. The policy pattern(~m)
will do the same thing, as the absent
title
defaults to
\1
.
See the section the section called “Search Patterns”
for more information on the format of
pattern
.
priority
Groups packages according to their priority.
section[(mode
[,passthrough])]
Groups packages according to their Section field.
mode
can be one of the
following:
none
Group based on the whole Section field, so categories like “non-free/games” will be created.
topdir
Group based on the part of the Section field
before the “/
”; if there is
no /
,
main
will be used instead.
subdir
Group based on the part of the Section field
after the “/
”; if there is
no /
, the entire field will
be used.
If passthrough
is present,
packages which for some reason lack a true Section
(for instance, virtual packages) will be passed
directly to the next level of grouping without first
being placed in sub-categories.
status
Groups packages into the following categories:
Installed
Not Installed
Security Updates
Upgradable
Obsolete
Virtual
tag[(facet
)]
Groups packages according to the Tag information
stored in the Debian package files. If
facet
is provided, then
only tags corresponding to that facet will be
displayed, and packages lacking this facet will be
hidden; otherwise, all packages will be displayed at
least once (with tagless packages listed separately
from packages that have tags).
For more information on debtags, see http://debtags.alioth.debian.org.
task
Creates a tree called “Tasks” which contains the
available tasks (information on tasks is read from
debian-tasks.desc
in the
package tasksel
). The rule
following task
will create its
categories as siblings of Tasks.
versions
This is a terminal rule.
Creates standard package items which can be expanded to reveal the versions of the package.
By default, packages in the package list are sorted by name. However, it is often useful to sort them according to different criteria (for instance, package size), and aptitude allows you to do just that by modifying the sorting policy.
Like the grouping policy described in the previous section,
the sorting policy is a comma-separated list. Each item
in the list is the name of a sorting rule; if packages are
“equal” according to the first rule, the second rule is
used to sort them, and so on. Placing a tilde character
(~
) in front of a rule reverses the
usual meaning of that rule. For instance,
priority,~name
will sort packages by
priority, but packages with the same priority will be
placed in reverse order according to name.
To change the sorting policy for an active package list, press S.
The available rules are:
installsize
Sorts packages by the estimated amount of size they require when installed.
name
Sorts packages by name.
priority
Sorts packages by priority.
version
Sorts packages according to their version number.