Linux apt 命令8679879
Linux apt 命令
apt(Advanced Packaging Tool)是一个在 Debian 和 Ubuntu 中的 Shell 前端软件包管理器。
apt 命令提供了查找、安装、升级、删除某一个、一组甚至全部软件包的命令,而且命令简洁而又好记。
apt 命令执行需要超级管理员权限(root)。
apt 语法
apt [options] [command] [package ...]
- options:可选,选项包括 -h(帮助),-y(当安装过程提示选择全部为"yes"),-q(不显示安装的过程)等等。
- command:要进行的操作。
- package:安装的包名。
apt 常用命令
-
列出所有可更新的软件清单命令:sudo apt update
-
升级软件包:sudo apt upgrade
列出可更新的软件包及版本信息:apt list --upgradable
升级软件包,升级前先删除需要更新软件包:sudo apt full-upgrade
-
安装指定的软件命令:sudo apt install
安装多个软件包:sudo apt install
-
更新指定的软件命令:sudo apt update
-
显示软件包具体信息,例如:版本号,安装大小,依赖关系等等:sudo apt show
-
https://avg.163.com/topic/detail/10892692
https://avg.163.com/topic/detail/10892657
https://avg.163.com/topic/detail/10892074
https://avg.163.com/topic/detail/10892577
https://avg.163.com/topic/detail/10892574
https://avg.163.com/topic/detail/10892007
https://avg.163.com/topic/detail/10892008
https://avg.163.com/topic/detail/10892557
https://avg.163.com/topic/detail/10892558
https://avg.163.com/topic/detail/10892553
https://avg.163.com/topic/detail/10892551
https://avg.163.com/topic/detail/10892533
https://avg.163.com/topic/detail/10892531
https://avg.163.com/topic/detail/10892498
https://avg.163.com/topic/detail/10892487
https://avg.163.com/topic/detail/10892466
https://avg.163.com/topic/detail/10892464
https://avg.163.com/topic/detail/10892460
https://avg.163.com/topic/detail/10892457
https://avg.163.com/topic/detail/10892439
https://avg.163.com/topic/detail/10892431
https://avg.163.com/topic/detail/10892428
https://avg.163.com/topic/detail/10892422
https://avg.163.com/topic/detail/10892399
https://avg.163.com/topic/detail/10892414
https://avg.163.com/topic/detail/10892411
https://avg.163.com/topic/detail/10892397
https://avg.163.com/topic/detail/10892388
https://avg.163.com/topic/detail/10892390
https://avg.163.com/topic/detail/10892380
https://avg.163.com/topic/detail/10892376
https://avg.163.com/topic/detail/10892352
https://avg.163.com/topic/detail/10892361
https://avg.163.com/topic/detail/10892355
https://avg.163.com/topic/detail/10891704
https://avg.163.com/topic/detail/10891734
https://avg.163.com/topic/detail/10892340
https://avg.163.com/topic/detail/10891699
https://avg.163.com/topic/detail/10892325
https://avg.163.com/topic/detail/10892324
https://avg.163.com/topic/detail/10892290
https://avg.163.com/topic/detail/10892265
https://avg.163.com/topic/detail/10892268
https://avg.163.com/topic/detail/10892271
https://avg.163.com/topic/detail/10892264
https://avg.163.com/topic/detail/10891618
https://avg.163.com/topic/detail/10892236
https://avg.163.com/topic/detail/10892239
https://avg.163.com/topic/detail/10892212
https://avg.163.com/topic/detail/10892225
https://avg.163.com/topic/detail/10892208
https://avg.163.com/topic/detail/10892209
https://avg.163.com/topic/detail/10892153
https://avg.163.com/topic/detail/10892147
https://avg.163.com/topic/detail/10891426
https://avg.163.com/topic/detail/10891511
https://avg.163.com/topic/detail/10891443
https://avg.163.com/topic/detail/10891434
https://avg.163.com/topic/detail/10892140
https://avg.163.com/topic/detail/10892136
https://avg.163.com/topic/detail/10892138
https://avg.163.com/topic/detail/10892130
https://avg.163.com/topic/detail/10892127
https://avg.163.com/topic/detail/10892046
https://avg.163.com/topic/detail/10892074
https://avg.163.com/topic/detail/10892053
https://avg.163.com/topic/detail/10892025
https://avg.163.com/topic/detail/10891249
https://avg.163.com/topic/detail/10892026
https://avg.163.com/topic/detail/10892006
https://avg.163.com/topic/detail/10892007
https://avg.163.com/topic/detail/10892008
https://avg.163.com/topic/detail/10891998
https://avg.163.com/topic/detail/10891988
https://avg.163.com/topic/detail/10891979
https://avg.163.com/topic/detail/10891947
https://avg.163.com/topic/detail/10891387
https://avg.163.com/topic/detail/10891930
https://avg.163.com/topic/detail/10891162
https://avg.163.com/topic/detail/10891208
https://avg.163.com/topic/detail/10891085
https://avg.163.com/topic/detail/10891878
https://avg.163.com/topic/detail/10891871
https://avg.163.com/topic/detail/10891874
https://avg.163.com/topic/detail/10891844
https://avg.163.com/topic/detail/10889995
https://avg.163.com/topic/detail/10891826
https://avg.163.com/topic/detail/10891803
https://avg.163.com/topic/detail/10891767
https://avg.163.com/topic/detail/10891766
https://avg.163.com/topic/detail/10891782
https://avg.163.com/topic/detail/10891764
https://avg.163.com/topic/detail/10891754
https://avg.163.com/topic/detail/10890927
https://avg.163.com/topic/detail/10891745
https://avg.163.com/topic/detail/10891747
https://avg.163.com/topic/detail/10891741
https://avg.163.com/topic/detail/10891734
https://avg.163.com/topic/detail/10891711
https://avg.163.com/topic/detail/10891713
https://avg.163.com/topic/detail/10891704
https://avg.163.com/topic/detail/10891699
https://avg.163.com/topic/detail/10891696
https://avg.163.com/topic/detail/10891683
https://avg.163.com/topic/detail/10891680
https://avg.163.com/topic/detail/10891670
https://avg.163.com/topic/detail/10891650
https://avg.163.com/topic/detail/10890786
https://avg.163.com/topic/detail/10891636
https://avg.163.com/topic/detail/10891618
https://avg.163.com/topic/detail/10891583
https://avg.163.com/topic/detail/10891566
https://avg.163.com/topic/detail/10891559
https://avg.163.com/topic/detail/10891546
https://avg.163.com/topic/detail/10891543
https://avg.163.com/topic/detail/10891532
https://avg.163.com/topic/detail/10891538
https://avg.163.com/topic/detail/10890488
https://avg.163.com/topic/detail/10891533
https://avg.163.com/topic/detail/10891544
https://avg.163.com/topic/detail/10891530
https://avg.163.com/topic/detail/10891511
https://avg.163.com/topic/detail/10891508
https://avg.163.com/topic/detail/10890368
https://avg.163.com/topic/detail/10891461
https://avg.163.com/topic/detail/10891443
https://avg.163.com/topic/detail/10891435
https://avg.163.com/topic/detail/10891434
https://avg.163.com/topic/detail/10891425
https://avg.163.com/topic/detail/10891426
https://avg.163.com/topic/detail/10890628
https://avg.163.com/topic/detail/10891414
https://avg.163.com/topic/detail/10891250
https://avg.163.com/topic/detail/10891406
https://avg.163.com/topic/detail/10891387
https://avg.163.com/topic/detail/10890364
https://avg.163.com/topic/detail/10891285
https://avg.163.com/topic/detail/10891268
https://avg.163.com/topic/detail/10891248
https://avg.163.com/topic/detail/10891249
https://avg.163.com/topic/detail/10891243
https://avg.163.com/topic/detail/10891227
https://avg.163.com/topic/detail/10891208
https://avg.163.com/topic/detail/10890272
https://avg.163.com/topic/detail/10891218
https://avg.163.com/topic/detail/10891210
https://avg.163.com/topic/detail/10891192
https://avg.163.com/topic/detail/10891185
https://avg.163.com/topic/detail/10891162
https://avg.163.com/topic/detail/10891164
https://avg.163.com/topic/detail/10891159
https://avg.163.com/topic/detail/10891125
https://avg.163.com/topic/detail/10891085
https://avg.163.com/topic/detail/10891051
https://avg.163.com/topic/detail/10890999
https://avg.163.com/topic/detail/10891009
https://avg.163.com/topic/detail/10891000
https://avg.163.com/topic/detail/10890996
https://avg.163.com/topic/detail/10890975
https://avg.163.com/topic/detail/10890986
https://avg.163.com/topic/detail/10890066
https://avg.163.com/topic/detail/10890000
https://avg.163.com/topic/detail/10890929
https://avg.163.com/topic/detail/10890006
https://avg.163.com/topic/detail/10889595
https://avg.163.com/topic/detail/10889067
https://avg.163.com/topic/detail/10890868
https://avg.163.com/topic/detail/10889978
https://avg.163.com/topic/detail/10890840
https://avg.163.com/topic/detail/10890834
https://avg.163.com/topic/detail/10890038
https://avg.163.com/topic/detail/10890830
https://avg.163.com/topic/detail/10890760
https://avg.163.com/topic/detail/10890786
-
删除软件包命令:sudo apt remove
-
清理不再使用的依赖和库文件: sudo apt autoremove
-
移除软件包及配置文件: sudo apt purge
-
查找软件包命令: sudo apt search
-
列出所有已安装的包:apt list --installed
-
列出所有已安装的包的版本信息:apt list --all-versions
实例
查看一些可更新的包:
sudo apt update

升级安装包:
sudo apt upgrade

在以上交互式输入字母 Y 即可开始升级。
可以将以下两个命令组合起来,一键升级:
sudo apt update && sudo apt upgrade -y
安装 mplayer 包:
sudo apt install mplayer

如过不太记得完整的包名,我们可以只输入前半部分的包名,然后按下 Tab 键,会列出相关的包名:

以上实例我们输入来 reds,然后按下 Tab 键,输出来四个相关的包。
如果我们想安装一个软件包,但如果软件包已经存在,则不要升级它,可以使用 –no-upgrade 选项:
sudo apt install--no-upgrade
安装 mplayer 如果存在则不要升级:
sudo apt install mplayer --no-upgrade









