apt

...

在 Ubuntu 16.04 上操作的...

APT 命令帮助

~# apt --help
apt 1.2.24 (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 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 --installed
apt list | grep '^apt'
apt list | grep '^apt$'

apt list 命令会打印软件源中的所有包, 包括已安装的和未安装的。

而命令中的--installed表示只打印已安装的包, 以便我们查看

移除包

包安装后提供了功能和便利, 但当我们想要卸载/移除包时要如何操作呢?

apt remove <package-name>

apt remove 会删除指定的包,但不会删除相关的依赖.

apt autoremove <package-name>

apt autoremove 会自动删除所有未使用的包以及相关的依赖,若指定时候则会删除该包及相关依赖,如

apt autoremove git

常用操作

apt update & apt full-upgrade更新软件源后升级软件和系统.
apt install <packname>安装某项软件包
apt clean清除apt update后形成的软件包缓存,缓存大小可用du -sh /var/cache/apt/命令查看
apt autoclean清除已卸载的软件包,就是把下载并安装又卸载了的软件的安装文件从硬盘中删除
apt autoremove删除那些为满足其他软件依赖而安装的,但现在不需要的软件包
apt remove <packname>删除指定的软件包,但保留配置文件等
apt purse <packname>删除指定的软件包,同时删除配置文件,会删的比较干净,所以叫purse
posted @ 2017-09-30 08:39  taadis  阅读(87)  评论(0编辑  收藏  举报