What is linux aptitude

Linux aptitude command

aptitude is the text-based front-end for the APT package management system. It allows the user to view the list of packages and to perform package management tasks such as installing, upgrading, and removing packages. Actions may be performed from a visual interface or from the command-line.

Syntax

Actions

The first argument which does not begin with a hyphen (««) is considered to be an action that the program should perform. If an action is not specified on the command-line, aptitude starts up in visual mode.

install Install one or more packages. The packages should be listed after the «install» command; if a package name contains a tilde character («

«) or a question mark («?«), it will be treated as a search pattern and every package matching the pattern will be installed.

To select a particular version of the package, append = to the package name: for instance, aptitude install apt=0.3.1. Similarly, to select a package from a particular archive, append / to the package name: for instance, aptitude install apt/experimental. You cannot specify both an archive and a version for a package.

Not every package listed on the command line has to be installed; you can tell aptitude to do something different with a package by appending an «override specifier» to the name of the package. For example, aptitude remove wesnoth+ will install «wesnoth», not remove it. The following override specifiers are available:

package+ Install package.
package+M Install package and immediately mark as automatically installed (note that if nothing depends on package, this causes it to be immediately removed).
package Remove package.
package_ Purge package: remove it and all its associated configuration and data files.
package= Place package on hold: cancel any active installation, upgrade, or removal, and prevent this package from being automatically upgraded in the future.
package: Keep package at its current version: cancel any installation, removal, or upgrade. Unlike «hold» (above) this does not prevent automatic upgrades in the future.
package&M Mark package as having been automatically installed.
package&m Mark package as having been manually installed.

As a special case, «install» with no arguments will act on any stored/pending actions.

Once you enter «Y» at the final confirmation prompt, the install command modifies aptitude’s stored information about what actions to perform. Therefore, if you issue (for example) the command aptitude install foo bar and then abort the installation once aptitude has started downloading and installing packages, you need to run aptitude remove foo bar to cancel that order.

remove, purge,
hold, unhold,
keep, reinstall
These commands are the same as install, but apply the named action to all packages given on the command line for which it is not overridden.

The difference between hold and keep is that hold causes a package to be ignored by future safe-upgrade or full-upgrade commands, while keep merely cancels any scheduled actions on the package. unhold allows a package to be upgraded by future safe-upgrade or full-upgrade commands, without otherwise altering its state.

For instance, aptitude remove ‘

ndeity’ removes all packages whose name contains «deity».

markauto,
unmarkauto
Mark packages as automatically installed or manually installed, respectively. Packages are specified in the same way as for the install command. For instance, aptitude markauto ‘

slibs’ will mark all packages in the «libs» section as having been automatically installed.

build-depends,
build-dep
Satisfy the build dependencies of a package. Each package name may be a source package, in which case the build dependencies of that source package are installed; otherwise, binary packages are found in the same way as for the install command, and the build-dependencies of the source packages that build those binary packages are satisfied.

If the command-line parameter —arch-only is present, only architecture-dependent build dependencies (i.e., not Build-Depends-Indep or Build-Conflicts-Indep) will be obeyed.

forbid-version Forbid a package from being upgraded to a particular version. This prevents aptitude from automatically upgrading to this version, but allows automatic upgrades to future versions. By default, aptitude selects the version of the package; you may override this selection by appending = to the package name: for instance, aptitude forbid-version vim=1.2.3.broken-4.

This command is useful for avoiding broken versions of packages without having to set and clear manual holds. If you decide you want the forbidden version after all, aptitude install

removes the ban.

update Updates the list of available packages from the apt sources (this is equivalent to apt-get update).
safe-upgrade Upgrades installed packages to their most recent version. Installed packages will not be removed unless they are unused. Packages that are not currently installed may be installed to resolve dependencies unless the —no-new-installs command-line option is supplied.

s can be extended with suffixes in the same manner as arguments to aptitude install, so you can also give additional instructions to aptitude here; for instance, aptitude safe-upgrade bash dash- attempts to upgrade the «bash» package and remove the «dash» package.

It is sometimes necessary to remove one package to upgrade another; this command is not able to upgrade packages in such situations. Use the full-upgrade command to upgrade as many packages as possible.

full-upgrade Upgrades installed packages to their most recent version, removing or installing packages as necessary. This command is less conservative than safe-upgrade and thus more likely to perform unwanted actions. However, it is capable of upgrading packages that safe-upgrade cannot upgrade.

can be extended with suffixes in the same manner as arguments to aptitude install, so you can also give additional instructions to aptitude here; for instance, aptitude full-upgrade bash dash- attempts to upgrade the «bash» package and remove the «dash» package.

This command was originally named dist-upgrade for historical reasons, and aptitude still recognizes dist-upgrade as a synonym for full-upgrade.

keep-all Cancels all scheduled actions on all packages; any packages whose sticky state indicates an installation, removal, or upgrade has this sticky state cleared.
forget-new Forgets all internal information about what packages are «new» (equivalent to pressing «f» when in visual mode).
search Searches for packages matching one of the patterns supplied on the command line. All packages that match any of the given patterns will display; for instance, aptitude search ‘

N’ edit lists all «new» packages and all packages whose name contains «edit». For more information on search patterns, see the section «Search Patterns» in the aptitude reference manual.

In the example above, aptitude search ‘

N’ edit has two arguments after search and thus is searching for two patterns: «

N» and «edit». As described in the search pattern reference, a single pattern composed of two sub-patterns separated by a space (such as

N edit) matches only if both patterns match. Thus, the command aptitude search ‘

N edit’ only shows «new» packages whose name contains «edit».

Each search result is listed on a separate line. The first character of each line indicates the current state of the package: the most common states are p, meaning that no trace of the package exists on the system, c, meaning that the package was deleted but its configuration files remain on the system, i, meaning that the package is installed, and v, meaning that the package is virtual. The second character indicates the stored action (if any; otherwise a blank space is displayed) to be performed on the package, with the most common actions being i, meaning that the package will be installed, d, meaning that the package will be deleted, and p, meaning that the package and its configuration files will be removed. If the third character is A, the package was automatically installed.

To customize the output of search, see the command-line options -F and —sort.

show Displays detailed information about one or more packages, listed following the search command. If a package name contains a tilde character («

«) or a question mark («?«), it will be treated as a search pattern and all matching packages are displayed.

If the verbosity level is 1 or greater (i.e., at least one -v is present on the command-line), information about all versions of the package is displayed. Otherwise, information about the «candidate version» (the version that aptitude install would download) is displayed.

You can display information about a different version of the package by appending = to the package name; you can display the version from a particular archive or release by appending / or / to the package name: for instance, /unstable or /sid. If either of these is present, then only the version you request is displayed, regardless of the verbosity level.

If the verbosity level is 1 or greater, the package’s architecture, compressed size, file name, and md5sum fields are displayed. If the verbosity level is 2 or greater, the select version or versions are displayed once for each archive found.

versions Displays the versions of the packages listed on the command-line.

As you can see, each version is listed on a separate line. The leftmost three characters indicate the current state, planned state (if any), and whether the package was automatically installed; for more information on their meanings, see the documentation of aptitude search. To the right of the version number you can find the releases from which the version is available, and the pin priority of the version.

If a package name contains a tilde character («

«) or a question mark («?«), it will be treated as a search pattern and all matching versions are displayed (see the section «Search Patterns» in the aptitude reference manual). This means that, for instance, aptitude versions ‘

i’ displays all the versions that are currently installed on the system and nothing else, not even other versions of the same packages.

If the input is a search pattern, or if more than one package’s versions are to be displayed, aptitude automatically groups the output by package, as shown above. You can disable this via —group-by=none, in which case aptitude displays a single list of all the versions that were found and automatically include the package name in each output line:

To disable the package name, pass —show-package-names=never:

In addition to the above options, the information printed for each version can be controlled by the command-line option -F. The order versions are displayed can be controlled by the command-line option —sort. To prevent aptitude from formatting the output into columns, use —disable-columns.

add-user-tag, remove-user-tag Adds a user tag to or removes a user tag from the selected group of packages. If a package name contains a tilde («

«) or question mark («?»), it is treated as a search pattern and the tag is added to or removed from all the packages that match the pattern (see the section «Search Patterns» in the aptitude reference manual).

User tags are arbitrary strings associated with a package. They can be used with the ?user-tag( ) search term, which selects all the packages with a user tag matching .

why, why-not Explains the reason that a particular package should or cannot be installed on the system.

This command searches for packages that require or conflict with the given package. It displays a sequence of dependencies leading to the target package, along with a note indicating the installed state of each package in the dependency chain:

The command why finds a dependency chain that installs the package named on the command line, as above. Note that the dependency that aptitude produced in this case is only a suggestion. This is because no package currently installed on this computer depends on or recommends the kdepim package; if a stronger dependency were available, aptitude would have displayed it.

In contrast, why-not finds a dependency chain leading to a conflict with the target package:

are present, then aptitude will begin its search at these patterns; that is, the first package in the chain it prints will be a package matching the pattern in question. The patterns are considered to be package names unless they contain a tilde character («

«) or a question mark («?»), in which case they are treated as search patterns (see the section «Search Patterns» in the aptitude reference manual).

If no patterns are present, then aptitude will search for dependency chains beginning at manually installed packages. This effectively shows the packages that have caused or would cause a given package to be installed.

Aptitude why does not perform full dependency resolution; it only displays direct relationships between packages. For instance, if A requires B, C requires D, and B and C conflict, aptitude why-not D will not produce the answer «A depends on B, B conflicts with C, and D depends on C». By default, aptitude outputs only the «most installed, strongest, tightest, shortest» dependency chain. That is, it looks for a chain that only contains packages that are installed or will be installed; it looks for the strongest possible dependencies under that restriction; it looks for chains that avoid OR’ed dependencies and Provides; and it looks for the shortest dependency chain meeting those criteria. These rules are progressively weakened until a match is found.

If the verbosity level is 1 or more, then all the explanations aptitude can find are displayed, in inverse order of relevance. If the verbosity level is 2 or more, a truly excessive amount of debugging information will be printed to standard output.

This command returns 0 if successful, 1 if no explanation could be constructed, and -1 if an error occurred.

clean Removes all previously downloaded .deb files from the package cache directory (usually located at /var/cache/apt/archives).
autoclean Removes any cached packages that can no longer be downloaded. This allows you to prevent a cache from growing out of control over time without completely emptying it.
changelog Downloads and displays the Debian changelog for each of the given source or binary packages.

By default, the changelog for the version which would be installed with aptitude install is downloaded. You can select a particular version of a package by appending = to the package name; you can select the version from a particular archive or release by appending / or / to the package name (for instance, /unstable or /sid).

download Downloads the .deb file for the given package to the current directory. If a package name contains a tilde character («

«) or a question mark («?»), it will be treated as a search pattern and all the matching packages will be downloaded.

By default, the version which would be installed with aptitude install is downloaded. You can select a particular version of a package by appending = to the package name; you can select the version from a particular archive or release by appending / or

For full-upgrade, safe-upgrade, forbid-version, hold, install, keep-all, markauto, unmarkauto, purge, reinstall, remove, unhold, and unmarkauto: add the user tag to all packages that are installed, removed, or upgraded by this command as if with the add-user-tag command.
—add-user-tag-to ,

For full-upgrade, safe-upgrade, forbid-version, hold, install, keep-all, markauto, unmarkauto, purge, reinstall, remove, unhold, and unmarkauto: add the user tag to all packages that match

as if with the add-user-tag command. The pattern is a search pattern as described in the section «Search Patterns» in the aptitude reference manual.

For instance, aptitude safe-upgrade —add-user-tag-to «new-installs,?action(install)» adds the tag new-installs to all the packages installed by the safe-upgrade command.

—allow-new-upgrades When the safe resolver is used (i.e., —safe-resolver was passed, the action is safe-upgrade, or Aptitude::Always-Use-Safe-Resolver is set to true), allow the dependency resolver to install upgrades for packages regardless of the value of Aptitude::Safe-Resolver::No-New-Upgrades.
—allow-new-installs Allow the safe-upgrade command to install new packages; when the safe resolver is used (i.e., —safe-resolver was passed, the action is safe-upgrade, or Aptitude::Always-Use-Safe-Resolver is set to true), allow the dependency resolver to install new packages. This option takes effect regardless of the value of Aptitude::Safe-Resolver::No-New-Installs.
—allow-untrusted Install packages from untrusted sources without prompting. You should only use this if you know what you are doing, as it could easily compromise your system’s security.
—disable-columns This option causes aptitude search and aptitude versions to output their results without any special formatting. In particular: normally aptitude adds whitespace or truncate search results in an attempt to fit its results into vertical «columns». With this flag, each line will be formed by replacing any format escapes in the format string with the corresponding text; column widths is ignored.

For instance, the first few lines of output from aptitude search -F ‘%p %V’ —disable-columns libedataserver might be:

As in the above example, —disable-columns is often useful in combination with a custom display format set using the command-line option -F.

Источник

Читайте также:  Ipod touch and windows
Оцените статью