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
[支持/订阅](https://afdian.com/a/taadis)作者,以获得更多服务.
· 深入理解 Mybatis 分库分表执行原理
· 如何打造一个高并发系统?
· .NET Core GC压缩(compact_phase)底层原理浅谈
· 现代计算机视觉入门之:什么是图片特征编码
· .NET 9 new features-C#13新的锁类型和语义
· Spring AI + Ollama 实现 deepseek-r1 的API服务和调用
· 《HelloGitHub》第 106 期
· 数据库服务器 SQL Server 版本升级公告
· 深入理解Mybatis分库分表执行原理
· 使用 Dify + LLM 构建精确任务处理应用