@breakerthb
2017-06-19T02:16:33.000000Z
字数 1439
阅读 2056
Linux
Shell
apt-cache search package 搜索软件包
apt-cache show package 获取包的相关信息,如说明、大小、版本等
sudo apt-get install package 安装包
sudo apt-get install package --reinstall 重新安装包
sudo apt-get -f install 修复安装
sudo apt-get remove package 删除包
sudo apt-get remove package --purge 删除包,包括配置文件等
sudo apt-get update 更新源
sudo apt-get upgrade 更新已安装的包
sudo apt-get dist-upgrade 升级系统
apt-cache depends package 了解使用该包依赖那些包
apt-cache rdepends package 查看该包被哪些包依赖
sudo apt-get build-dep package 安装相关的编译环境
apt-get source package 下载该包的源代码
sudo apt-get clean && sudo apt-get autoclean 清理无用的包
sudo apt-get check 检查是否有损坏的依赖
依赖包不存在:
$ apt-get -f install # 后面什么也不加
$ dpkg --get-selections | grep -v deinstall
$ dpkg -l
$ apt-get -u upgrade --assume-no
/etc/apt/apt.conf
$ echo "Acquire::http::proxy \"http://109.105.112.138:3128\";" > /etc/apt/apt.conf
ref : apt-get和dpkg命令
Ubuntu 16.04之后,Ubuntu的软件包管理命令采用了 Debian 项目中所使用的 APT(Advanced Package Tool)来完成各种的不同的任务
APT 命令全面取代了我们之前在 Linux 软件包管理基本操作入门中所介绍的 apt-get、apt-cache 、功能。
为兼顾老用户的使用习惯 Ubuntu 16.04 依然保留着 apt-get 系列命令
ATP 命令与老版本 Ubuntu 中软件包管理的用法对比:
Ubuntu 16.04 LTS | 老版本Ubuntu |
---|---|
apt install 包名 | apt-get install 包名 |
apt remove 包名 | apt-get remove 包名 |
apt search 包名 | apt-cache search 包名 |
apt show 包名 | apt-cache show 包名 |
apt update | apt-get update |
apt upgrade | apt-get upgrade |
apt list --installed | dpkg --get-selections | grep -v deinstall 和 dpkg -l |
apt list --upgradable | apt-get -u upgrade --assume-no |
apt edit-sources | echo ‘new line of text’ | sudo tee -a /etc/apt/sources.list 和sudo vim /etc/apt/sources.list |
apt autoremove | apt-get autoremove |
apt purge 包名 | apt-get purge 包名 |