Ubuntu通过apt-get安装指定版本和查询指定软件有多少个版本
一、通过apt-get安装指定版本
apt-get install <<package name>>=<<version>>
二、查询指定软件有多少个版本
说明:在Linux用这个查询并不能完全的把所有版本都列举出来,因为每个版本都与系统版本和CPU架构有关,比如一个软件支持Ubuntu系统的16.04的CPU架构为amd64的版本只有1.0和1.2,其余都不支持,所以列举时就只有两款。
列举版本列表:
0、通过网站搜索:
1、
apt-cache madison <<package name>>
将列出所有来源的版本。如下输出所示:
apt-cache madison vim
vim | 2:7.3.547-1 | http://debian.mirrors.tds.net/debian/ unstable/main amd64 Packages
vim | 2:7.3.429-2 | http://debian.mirrors.tds.net/debian/ testing/main amd64 Packages
vim | 2:7.3.429-2 | http://http.us.debian.org/debian/ testing/main amd64 Packages
vim | 2:7.3.429-2 | http://debian.mirrors.tds.net/debian/ testing/main Sources
vim | 2:7.3.547-1 | http://debian.mirrors.tds.net/debian/ unstable/main Sources
madison
是一个apt-cache
子命令,可以通过man apt-cache查询更多用法。
2、
apt-cache policy <<package name>>
将列出所有来源的版本。信息会比上面详细一点,如下输出所示:
apt-cache policy gdb
gdb:
Installed: 7.7.1-0ubuntu5~14.04.2
Candidate: 7.7.1-0ubuntu5~14.04.2
Version table:
*** 7.7.1-0ubuntu5~14.04.2 0
500 http://fr.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
100 /var/lib/dpkg/status
7.7-0ubuntu3 0
500 http://fr.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
policy
是一个apt-cache
子命令,可以通过man apt-cache查询更多用法。
3、
apt-cache showpkg <<package name>>
4、
apt-get install -s <<package-name>>
说明:这个命令只是模拟安装时会安装哪些软件列表,但不会例举出每个软件有多少个版本
5、
aptitude versions <<package name>>
参考:https://manpages.debian.org/unstable/aptitude/aptitude.8.en.html
6、
apt-show-versions -a <<package name>>
说明:列举出所有版本,且能查看是否已经安装。还可以通过apt-show-versions -u <<package name>>来查询是否有升级版本。
参考:http://manpages.ubuntu.com/manpages/trusty/man1/apt-show-versions.1p.html
7、
whohas -d Debian,Ubuntu <<package name>> | tr -s ' ' '\t' | cut -f 1-3 | column -t
8、
rmadison -u debian,ubuntu,bpo <<package name>> | cut -d "|" -f 1-3
单个详情:
1、
apt-cache show <<package name>>
说明:查询指定包的详情,不管是否已经安装。
2、
dpkg -l <<package name>>
说明:效果和上面基本一致,但是结果是列表详情展示,会提示是否已经删除了之后还有依赖包没有删除等。
3、
dpkg -s <<package name>>
说明:必须是安装的包才能显示详情。
4、
dpkg-query -s <<package name>>
说明:同上,效果一致。
使用技巧:
1、可以在查询后面带上一些参数来实现筛选
apt-cache show package | grep Version
apt-show-versions | more
参考:
http://wiki.ubuntu.org.cn/Apt%E5%92%8Cdpkg%E5%BF%AB%E9%80%9F%E5%8F%82%E8%80%83(apt-get常用语法)
https://askubuntu.com/questions/473886/list-all-versions-of-a-package
http://www.wkii.org/view-package-version-ubuntu.html
最新文章
- ast模块
- HttpListener supports SSL only for localhost? install certificate
- 小笔记(二):php数组
- 利用canvas压缩图片
- [Swift]LeetCode1007. 行相等的最少多米诺旋转 | Minimum Domino Rotations For Equal Row
- React条件渲染
- laravel项目安装
- css3不错的教程
- 7.26-STOIRegularMatch-08-#14
- FineUI 布局宽度自适应,后台回调js方法
- Linux增加swap空间
- Android开发,在Fragment中,隐藏或关闭软键盘(虚拟键盘)的方法
- 【转】每天一个linux命令(26):用SecureCRT来上传和下载文件
- SpringCloud初体验:七、gateway 网关服务如何做token验证
- Zookeeper(三)-- JAVA原生API
- TaskTracker学习笔记
- Android 必须知道2018年流行的框架库及开发语言,看这一篇就够了!
- SpringBoot15 sell01 项目创建、MySQL数据库连接、日志配置、开发热部署、商品信息模块
- vscode + leetcode +github 同步
- iOS书摘之Objective-C编程之道 iOS设计模式解析