v>

linux apt命令详解


linux软件安装与卸载

回到顶部

apt命令是Debian Linux发行版中的APT软件包管理工具。所有基于Debian的发行都使用这个包管理系统。deb包可以把一个应用的文件包在一起,大体就如同Windows上的安装文件。 apt命令可以用来安装和更新软件,例如我们想要安装nginx,只需要要在命令行输入如下命令即可安装nginx:

$ sudo apt install nginx

使用apt remove卸载软件(保留配置文件):

$ sudo apt remove nginx

apt remove不会删除软件的配置文件,如果想彻底卸载软件,连同软件的配置文件也一起删除,可以使用apt purge:

$ sudo apt purge nginx

卸载软件及其依赖的安装包:

$ sudo apt autoremove nginx

使用apt update更新安装列表,apt upgrade更新系统:

$ sudo apt update
$ sudo apt upgrade

使用apt autoclean命令可以清除那些已经卸载的软件包的.deb文件,通过这种方式,可以释放大量的磁盘空间:

$ sudo apt autoclean
apt clean命令可以将已安装和已卸载软件的.deb文件全部删除,如果磁盘空间紧张,需要释放更多的磁盘空间,可以使用apt clean命令:
$ sudo apt clean

aptitude命令与apt命令一样,都是Debian Linux及其衍生系统中功能极其强大的包管理工具。 与apt不同的是,aptitude在处理依赖问题上更好一些。举例来说,aptitude在删除一个包时,会同时删除本身所依赖的包。 这样,系统中不会残留无用的包,整个系统更为干净。很多情况下,在使用apt出现报错的时候,可以尝试使用aptitude替代

Usage:
apt command [options]
apt help command [options]
Commands:
add-repository - Add entries to apt sources.list
autoclean - Erase old downloaded archive files
autoremove - Remove automatically all unused packages
build - Build binary or source packages from sources
build-dep - Configure build-dependencies for source packages
changelog - View a package's changelog
check - Verify that there are no broken dependencies
clean - Erase downloaded archive files
contains - List packages containing a file
content - List files contained in a package
deb - Install a .deb package
depends - Show raw dependency information for a package
dist-upgrade - Upgrade the system by removing/installing/upgrading packages
download - Download the .deb file for a package
edit-sources - Edit /etc/apt/sources.list with your preferred text editor
dselect-upgrade - Follow dselect selections
full-upgrade - Same as 'dist-upgrade'
held - List all held packages
help - Show help for a command
hold - Hold a package
install - Install/upgrade packages
list - List packages based on package names
policy - Show policy settings
purge - Remove packages and their configuration files
recommends - List missing recommended packages for a particular package
rdepends - Show reverse dependency information for a package
reinstall - Download and (possibly) reinstall a currently installed package
remove - Remove packages
search - Search for a package by name and/or expression
show - Display detailed information about a package
showhold - Same as 'held'
source - Download source archives
sources - Same as 'edit-sources'
unhold - Unhold a package
update - Download lists of new/upgradable packages
upgrade - Perform a safe upgrade
version - Show the installed version of a package

相关阅读:
linux基础
centos安装
linux mint(ubuntu)安装
什么是linux
linux学习方法建议和学习路线图
本文由initroot编辑整理,转载请注明www.initroot.com

100次点赞 100次阅读