apt-get使用命令

apt-get常用命令

一、apt命令

apt 安装软件

apt install <name>

 apt 搜索软件

apt search <name>

 

apt-get的卸载命令:remove/purge/autoremove/clean/autoclean 

apt-get purge / apt-get –purge remove <name>

—— 删除已安装包(不保留配置文件)。如软件包a,依赖软件包b,则执行该命令会删除a,而且不保留配置文件。 

apt-get autoremove <name>

—— 删除为了满足依赖而安装的,但现在不再需要的软件包(包括已安装包),保留配置文件。 

apt-get remove <name>

—— 删除已安装的软件包(保留配置文件),不会删除依赖软件包,且保留配置文件。 

apt-get autoclean <name>

—— APT的底层包是dpkg, 而dpkg 安装Package时, 会将 *.deb 放在 /var/cache/apt/archives/中,apt-get autoclean 只会删除 /var/cache/apt/archives/ 已经过期的deb。 

apt-get clean <name>

—— 使用 apt-get clean 会将 /var/cache/apt/archives/ 的 所有 deb 删掉,可以理解为 rm /var/cache/apt/archives/*.deb。

 

二、apt-cache命令

search regex...

apt-cache search <ley>

search performs a full text search on all available package lists for the POSIX regex pattern given, see regex(7). It searches the package names and the descriptions for an occurrence of the regular expression and prints out the package name and the short description, including virtual package names. If --full is given then output identical to show is produced for each matched package, and if --names-only is given then the long description is not searched, only the package name and provided packages are.

Separate arguments can be used to specify multiple search patterns that are and'ed together.

show pkg...

apt-cache show <pkg>

show performs a function similar to dpkg --print-avail; it displays the package records for the named packages.

madison pkg... 

apt-cache madison <pkg>

apt-cache's madison command attempts to mimic the output format and a subset of the functionality of the Debian archive management tool, madison. It displays available versions of a package in a tabular format. Unlike the original madison, it can only display information for the architecture for which APT has retrieved package lists (APT::Architecture).

 
OPTIONS 命令选项参数

-f, --full

搜索时打印完整的包裹记录。 Configuration Item: APT::Cache::ShowFull.

-a, --all-versions

打印所有可用版本的完整记录。这是默认设置;要关闭它,请使用 --no-all-versions.

如果没有指定所有版本,则只显示候选版本(选择用于安装)。此选项仅适用于show命令。配置项目:APT::Cache::AllVersions。

--names-only, -n

只搜索程序包和提供的程序包名称,而不是详细描述。Configuration Item:APT::Cache::NamesOnly.

g, --generate

执行包缓存自动重新生成,而不是按原样使用缓存。这是默认设置,要关闭它, 使用 --no-generate. Configuration Item: APT::Cache::Generate.

--all-names

使pkgnames打印所有名称,包括虚拟包和缺少的依赖项。Configuration Item:APT::Cache::AllNames.

--installed

将dependents和rdepends的输出限制为当前安装的程序包。Configuration Item:APT::Cache::Installed.

 
 

 

autoremove 
posted @ 2018-01-11 19:08  fieldtianye  阅读(207)  评论(0编辑  收藏  举报