Ubuntu-软件环境的维护-[apt]

[检查包的安装状态]

apt-cache policy + 包名

例如:

apt-cache policy python3.7-dev

输出:

python3.7-dev:
  Installed: 3.7.5-2~18.04.4
  Candidate: 3.7.5-2~18.04.4
  Version table:
 *** 3.7.5-2~18.04.4 500
        500 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages
        100 /var/lib/dpkg/status
     3.7.0~b3-1 500
        500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages

*注意 version table 内容会根据系统apt设置的源的不同而不同,如果国内加速源与官方源同步较好,应当仅有域名和路径不同。version table 不应当作为记录安装的这个软件来自于哪个源的参考。

包溯源较为复杂,如果网络允许,开发基于大量三方开源组件的系统,最好一直用官方源,避免一些稀奇古怪的bug。

 

其他方法检查包的安装状态:

https://linux.cn/article-11010-1.html

 


 

[查找源上包的信息]:

输入:

sudo apt-get update

完成更新后:

apt-cache search 包名关键字|grep 子关键字1|grep 子关键字2|more 

(可以用:子关键字|grep 子关键字  管道往后延,逐次添加关键字 来缩小搜索范围,|more 用来分页,屏幕够大可以不要more,有时候带有more的时候关键字不会高亮,高亮规则是grep管道最后的一个搜索关键字)

apt-cache search vlc|grep player|more

输出:

freeplayer - wrapper around vlc for French ADSL FreeBox
freetuxtv - Internet television and radio player
kaffeine - versatile media player for KDE
libvlc5 - multimedia player and streamer library
mpris-remote - command-line interface for mpris compatible media players
streamlink - CLI for extracting video streams from various websites to a video player
vlc - multimedia player and streamer
vlc-plugin-access-extra - multimedia player and streamer (extra access plugins)
vlc-plugin-base - multimedia player and streamer (base plugins)
vlc-plugin-qt - multimedia player and streamer (Qt plugin)
vlc-plugin-skins2 - multimedia player and streamer (Skins2 plugin)
vlc-plugin-video-output - multimedia player and streamer (video output plugins)
vlc-plugin-video-splitter - multimedia player and streamer (video splitter plugins)
vlc-plugin-visualization - multimedia player and streamer (visualization plugins)

 


 

 

[安装一个包]:

sudo apt-get install 包名

sudo apt-get install vlc

交互中会包含:输入用户密码,在源上的检索日志,是否要安装指定的包 [y/n]

 


 

[删除一个包]

sudo apt-get purge vlc

删除不再需要的依赖项

sudo apt-get autoremove

其他需要注意的事项:

https://blog.csdn.net/get_set/article/details/51276609

 


 

Ubuntu-软件环境的维护-[apt]

上一篇:powershell自定义快捷键


下一篇:Linux命令进阶篇之一