linux命令-rpm查询包
安装了哪些rpm包呢
[root@wangshaojun Packages]# rpm -qa /////查看全部安装的包
[root@wangshaojun Packages]# rpm -qa libxkbfile ///// -qa 跟包名
libxkbfile-1.0.6-1.1.el6.x86_64
[root@wangshaojun Packages]# rpm -qa vim ////不行
[root@wangshaojun Packages]# rpm -qa vim* //// 不行
[root@wangshaojun Packages]# rpm -qa |grep vim*////不行
[root@wangshaojun Packages]# rpm -qa |grep vim ////可以查到
vim-filesystem-7.4.629-5.el6.x86_64
vim-minimal-7.2.411-1.8.el6.x86_64
vim-common-7.4.629-5.el6.x86_64
vim-enhanced-7.4.629-5.el6.x86_64
[root@wangshaojun Packages]# rpm -qa |grep 'vim*'////加单引号
vim-filesystem-7.4.629-5.el6.x86_64
device-mapper-libs-1.02.95-3.el6_7.3.x86_64
vim-minimal-7.2.411-1.8.el6.x86_64
vim-common-7.4.629-5.el6.x86_64
sysvinit-tools-2.87-5.dsf.el6.x86_64
device-mapper-1.02.95-3.el6_7.3.x86_64
.......
查看包的详细信息
[root@wangshaojun Packages]# rpm -qi gnome-python2-extras
查看包安装了哪些文件
[root@wangshaojun Packages]# rpm -ql gnome-python2-extras
/usr/lib64/pkgconfig/gnome-python-extras-2.0.pc
/usr/share/doc/gnome-python2-extras-2.25.3
/usr/share/doc/gnome-python2-extras-2.25.3/AUTHORS
/usr/share/doc/gnome-python2-extras-2.25.3/ChangeLog
/usr/share/doc/gnome-python2-extras-2.25.3/NEWS
/usr/share/pygtk
/usr/share/pygtk/2.0
/usr/share/pygtk/2.0/defs
/usr/share/pygtk/2.0/defs/gtkhtml2.defs
/usr/share/pygtk/2.0/defs/trayicon.defs
查看文件有哪个包安装来的
[root@wangshaojun Packages]# rpm -qf /usr/share/pygtk/2.0/defs/gtkhtml2.defs
gnome-python2-extras-2.25.3-20.el6.x86_64
或者
[root@wangshaojun Packages]# which vim
/usr/bin/vim
[root@wangshaojun Packages]# rpm -qf /usr/bin/vim
vim-enhanced-7.4.629-5.el6.x86_64
[root@wangshaojun Packages]# rpm -qf 'which vim'
error: file /mnt/Packages/which vim: 没有那个文件或目录
[root@wangshaojun Packages]# rpm -qf `which vim`////反引号
vim-enhanced-7.4.629-5.el6.x86_64