Notes -Linux package management command

A, apt, apt-get, dpkg command

apt-get is a linux command for deb package management style operating system, mainly used for automatic search from the Internet software repository, install, upgrade, or uninstall the software operating system. Use apt-get mainstream Linux systems including Debian and Ubuntu versions of variability.

ackagename指代为软件包的名称

command Explanation
apt-get update Run this command after modifying /etc/apt/sources.list or / etc / apt / preferences. In addition, you need to run this command regularly to make sure your package list is up to date.
apt-get install packagename Installing a new software package (see below aptitude)
apt-get remove packagename Uninstall an installed software package (save the configuration file)
apt-get remove --purge packagename Uninstall software package (delete the configuration file) installed a
apt-get autoremove packagename Delete packages and their dependent packages
apt-get autoremove --purge packagname Delete packages and their dependencies package + profile than the above to remove it completely
apt-get autoclean apt would have been loading or unloading of software are already backed up on the hard drive, so if space is needed, it can make this command to delete the backup you have to uninstall the software.
apt-get clean This command will install the backup software is also removed, but this does not affect the use of the software.
apt-get upgrade You can use this command to update the package, apt-get upgrade can not only update package from the release version of the same version number, you can also update the new release version of the software package
apt-get dist-upgrade Plus -u option when running apt-get upgrade command is useful (ie: apt-get -u upgrade). This option causes APT to show the complete list of upgradeable packages. Without this option, you'll be upgrading blindly. APT will download the latest versions of each package, and then install them in the proper order. Note run apt-get update update the database running the command should be preceded, update any installed packages
apt-get dist-upgrade The system will be upgraded to a new version
apt-cache search string In the list of packages in the search string
apt-cache showpkg pkgs Display package information.
apt-cache dumpavail Print list of available packages.
apt-cache show pkgs Display package records, similar to dpkg -print-avail.
apt-cache pkgnames Any package name in the list printing software package.
apt-file search filename Find packages containing specific document (not necessarily installed), the string specified document name these documents contain. apt-file is a separate package. You must install him, and then run apt-file update using the apt-get install. If the contents are too many apt-file search filename output, you can try to use the apt-file search filename
apt-get autoclean Regularly run this command to clear the documents that have to uninstall .deb packages. This way, you can release large amounts of disk space. If you need very urgent, you can use apt-get clean in order to free up more space. This command will have to install software packages .deb file be deleted. In most cases, you will not use these .debs document, so if you are out of disk space to feel bruised and battered, this approach might be worth a try.

apt-get与apt-config、apt-cache(后两者可能对于新入坑的用户来说较为陌生)一样都是较为底层同时又包含众多功能的命令。对于一些常用的包管理命令(除了安装以外,还有查询、搜索等等),都被分散在这三个命令里面(例如,用apt-get install来安装软件包,用apt-cache search来查询/搜索软件包)

而apt命令的引入就是解决常用功能分散的功能,简单来说,apt命令是apt-get,apt-cache,apt-config三个命令中一些常用功能的集合。

apt 命令 取代的命令 命令的功能
apt install apt-get install 安装软件包
apt remove apt-get remove 移除软件包
apt purge apt-get purge 移除软件包及配置文件
apt update apt-get update 刷新存储库索引
apt upgrade apt-get upgrade 升级所有可升级的软件包
apt autoremove apt-get autoremove 自动删除不需要的包
apt full-upgrade apt-get dist-upgrade 在升级软件包时自动处理依赖关系
apt search apt-cache search 搜索应用程序
apt show apt-cache show 显示装细节
apt list 列出包含条件的包(已安装,可升级等)
apt edit-sources 编辑源列表

dpkg

dpkg是基于Debian的系统的软件包管理器。它可以安装,删除和构建软件包,但是与其他软件包管理系统不同,它无法自动下载和安装软件包或其依赖项。本节介绍如何使用 dpkg管理本地安装的软件包:

命令 说明
dpkg -l 要列出系统上安装的所有软件包
dpkg -l | grep apache2 根据系统上软件包的数量,这可能会产生大量输出。通过grep传递输出, 以查看是否安装了特定的软件包:
dpkg -L ufw 要列出软件包安装的文件(在本例中为ufw软件包),请输入
dpkg -S /etc/host.conf 如果不确定哪个软件包安装了文件,则dpkg -S可能会告诉您
sudo dpkg -i zip_3.0-4_i386.deb 安装本地.deb文件
sudo dpkg -r zip 卸载软件包

Guess you like

Origin www.cnblogs.com/wyid/p/12088536.html
Recommended