具有Aptitude的Linux软件包管理

Aptitude由Ncurses针对APT前端和debian Bundle Manager创建,考虑到它是基于文本的,并且可以从终端或CLI –命令行界面运行。本文介绍了有关“使用Aptitude进行Linux软件包管理”的内容

什么是APT

apt是一个命令行软件包管理器,提供用于搜索和管理以及查询有关软件包信息的命令。它提供与专用APT工具相同的功能,例如apt-get和apt-cache,但是默认情况下启用更适合交互式使用的选项。]

要获取有关APT的更多信息,请使用以下命令–

$ apt

样本输出应如下所示–

apt 1.2.15 (amd64)
Usage: apt [options] command
apt is a commandline package manager and provides commands for
searching and managing as well as querying information about packages.
It provides the same functionality as the specialized APT tools,
like apt-get and apt-cache, but enables options which are more suitable for
interactive use by default.
Most used commands:
   list - list packages based on package names
   search - search in package descriptions
   show - show package details
   install - install packages
   remove - remove packages
   autoremove - Remove automatically all unused packages
   update - update list of available packages
   upgrade - upgrade the system by installing/upgrading packages
   full-upgrade - upgrade the system by removing/installing/upgrading packages
   edit-sources - edit the source information file
See apt(8) for more information about the available commands.
Configuration options and syntax is detailed in apt.conf(5).
Information about how to configure sources can be found in sources.list(5).
Package and version choices can be expressed via apt_preferences(5).
Security details are available in apt-secure(8).
This APT has Super Cow Powers.

包列表

要获取基于软件包名称的软件包列表,请使用以下命令–

$ apt list

样本输出应如下所示–

revolution-r/xenial,xenial 3.0.0-1ubuntu1 all
revu-tools/xenial,xenial,trusty,trusty 0.6.1.5 all
rex/xenial,xenial 1.3.3-1 all
rexical/xenial,xenial 1.0.5-2build1 all
rexima/xenial 1.4-7build1 amd64
rfc5766-turn-server/trusty 3.2.3.1-1 amd64
rfcdiff/xenial,xenial 1.42-1 all
rfdump/xenial 1.6-4 amd64
rfkill/xenial,now 0.5-1ubuntu3 amd64 [installed,automatic]
rgbpaint/xenial,trusty 0.8.7-5 amd64
rgxg/xenial,trusty 0.1-1 amd64
rhash/xenial 1.3.3-1 amd64
rhc/xenial,xenial 1.38.4-2 all
rheolef/xenial 6.6-1build2 amd64
rheolef-doc/xenial,xenial 6.6-1build2 all
rhino/xenial,xenial 1.7R4-3 all
rhino-doc/xenial,xenial 1.7R4-3 all
rhinote/xenial,xenial,trusty,trusty 0.7.4-2 all
rhn-client-tools/xenial 1.8.26-4 amd64
rhnsd/xenial 5.0.4-3 amd64
..................................................................

安装包

要使用APT安装软件包,请使用以下命令-

$ sudo apt install firefox

上面的命令将安装firefox。样本输出应如下所示–

Reading package lists... Done
Building dependency tree
Reading state information... Done
firefox is already the newest version (50.1.0+build2-0ubuntu0.16.04.1).
firefox set to manually installed.
The following packages were automatically installed and are no longer required:
   libterm-readkey-perl linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic
   linux-image-4.4.0-31-generic linux-image-extra-4.4.0-31-generic
   linux-signed-image-4.4.0-31-generic
Use 'sudo apt autoremove' to remove them.
..................................................................

删除包

要使用APT删除软件包,请使用以下命令-

$ sudo apt remove firefox

上面的命令从Linux删除firefox软件包。样本输出应如下所示–

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libterm-readkey-perl linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic
linux-image-4.4.0-31-generic linux-image-extra-4.4.0-31-generic
linux-signed-image-4.4.0-31-generic
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
firefox
0 upgraded, 0 newly installed, 1 to remove and 26 not upgraded.
After this operation, 114 MB disk space will be freed.

删除未使用的包

要自动删除所有未使用的包,请使用以下命令–

$ sudo apt autoremove

样本输出应如下所示–

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
libterm-readkey-perl linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic
linux-image-4.4.0-31-generic linux-image-extra-4.4.0-31-generic
linux-signed-image-4.4.0-31-generic
0 upgraded, 0 newly installed, 6 to remove and 26 not upgraded.
After this operation, 295 MB disk space will be freed.
..............................................................................

更新包

要更新软件包,请使用以下命令–

$ sudo apt update

升级包

要通过安装/升级软件包来升级系统,请使用以下命令–

$ sudo apt upgrade

在阅读完本文之后,您将能够了解“使用Aptitude进行Linux软件包管理”,我们将提供更多基于Linux的技巧和窍门。继续阅读!