RPM常用命令中的各种缩写选项,其实是有依据的,弄明白之后,其实很好玩,我们可以参考下方:
q=query
p=package
i=info
l=list
f=file
c=conf
...
一:查看系统已安装软件相关命令
1、查询系统已安装的rpm包
#rpm -qa
示例:
NTP-slave:/etc/zypp # rpm -qa | grep zypp
zypper-log-1.6.307-0.7.12
zypper-1.6.307-0.7.12
libzypp-9.34.0-0.7.15
2、查询系统中一个已知的文件属于哪个rpm包
# rpm -qf /绝对路径/file_name
示例:
NTP-slave:/etc/zypp # rpm -qf /etc/zypp/zypp.conf
libzypp-9.34.0-0.7.15
3、 查询已安装的软件包的相关文件的安装路径
# rpm -ql 软件名
示例:
NTP-slave:/etc/zypp # rpm -ql libzypp-9.34.0-0.7.15
/etc/logrotate.d/zypp-history.lr
/etc/zypp
/etc/zypp/repos.d
/etc/zypp/services.d
/etc/zypp/systemCheck
/etc/zypp/zypp.conf
/usr/bin/package-manager
/usr/bin/package-manager-su
...省略...
4、查询一个已安装软件包的信息
#rpm -qi 软件名
示例:
NTP-slave:/etc/zypp # rpm -qi libzypp-9.34.0-0.7.15
Name : libzypp Relocations: (not relocatable)
Version : 9.34.0 Vendor: SUSE LINUX Products GmbH, Nuernberg, Germany
Release : 0.7.15 Build Date: Wed May 29 23:20:00 2013
Install Date: Mon Dec 19 20:00:23 2016 Build Host: crick2
...省略...
NTP-slave:/etc/zypp # rpm -qc libzypp-9.34.0-0.7.15
/etc/logrotate.d/zypp-history.lr
/etc/zypp/systemCheck
/etc/zypp/zypp.conf
5、查看已安装软件的配置文件
#rpm -qc 软件名
示例:
NTP-slave:/etc/zypp # rpm -qc libzypp-9.34.0-0.7.15
/etc/logrotate.d/zypp-history.lr
/etc/zypp/systemCheck
/etc/zypp/zypp.conf
6、查看已安装软件的文档的安装位置
#rpm -qd 软件名
示例:
NTP-slave:/etc/zypp # rpm -qd libzypp-9.34.0-0.7.15
/usr/share/man/man5/locks.5.gz
7、查看已安装软件所依赖的软件包及文件
#rpm -qR 软件名
示例:
NTP-slave:/etc/zypp # rpm -qR gcc43-4.3.4_20091019-0.37.30
binutils
glibc-devel
cpp43 = 4.3.4_20091019-0.37.30
libgcc1 >= 4.3.4_20091019-0.37.30
libgomp1 >= 4.3.4_20091019-0.37.30
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(CompressedFileNames) <= 3.0.4-1
libc.so.6()(64bit)
libc.so.6(GLIBC_2.11)(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.7)(64bit)
rpmlib(PayloadIsLzma) <= 4.4.6-1
二:查看系统未安装软件相关命令
首先要这个未安装rpm包存在,我们才能查看相关信息
1、查看软件包的详细信息
#rpm -qpi rpm包
示例:
suse11sp3-1:~ # rpm -qpi rzsz-0.12.20-934.22.x86_64.rpm
Name : rzsz Relocations: (not relocatable)
Version : 0.12.20 Vendor: SUSE LINUX Products GmbH, Nuernberg, Germany
Release : 934.22 Build Date: Sat Feb 21 09:28:18 2009
Install Date: (not installed) Build Host: brubeck
Group : Hardware/Modem Source RPM: rzsz-0.12.20-934.22.src.rpm
Size : 249242 License: GPL v2 or later
Signature : RSA/8, Sat Feb 21 09:28:23 2009, Key ID e3a5c360307e3d54
Packager : http://bugs.opensuse.org
URL : http://www.ohse.de/uwe/software/lrzsz.html
Summary : X-, Y-, and Z-Modem Data Transfer Protocols
Description :
rzsz allows you to use "sz filename" to send a file to your local
system.
Distribution: SUSE Linux Enterprise 11
2、查看软件包所包含的目录和文件
#rpm -qpl rpm包
示例:
suse11sp3-1:~ # rpm -qpl rzsz-0.12.20-934.22.x86_64.rpm
/usr/bin/rb
/usr/bin/rx
/usr/bin/rz
/usr/bin/sb
/usr/bin/sx
/usr/bin/sz
/usr/share/doc/packages/rzsz
/usr/share/doc/packages/rzsz/ABOUT-NLS
/usr/share/doc/packages/rzsz/AUTHORS
/usr/share/doc/packages/rzsz/COMPATABILITY
/usr/share/doc/packages/rzsz/COPYING
/usr/share/doc/packages/rzsz/ChangeLog
/usr/share/doc/packages/rzsz/NEWS
/usr/share/doc/packages/rzsz/README.cvs
/usr/share/doc/packages/rzsz/README.gettext
/usr/share/doc/packages/rzsz/README.isdn4linux
/usr/share/doc/packages/rzsz/README.tests
/usr/share/doc/packages/rzsz/THANKS
/usr/share/doc/packages/rzsz/TODO
/usr/share/locale/de/LC_MESSAGES/lrzsz.mo
/usr/share/man/man1/rz.1.gz
/usr/share/man/man1/sz.1.gz
3、查看软件包的文档所在的位置
#rpm -qpd rpm包
示例:
suse11sp3-1:~ # rpm -qpd rzsz-0.12.20-934.22.x86_64.rpm
/usr/share/doc/packages/rzsz/ABOUT-NLS
/usr/share/doc/packages/rzsz/AUTHORS
/usr/share/doc/packages/rzsz/COMPATABILITY
/usr/share/doc/packages/rzsz/COPYING
/usr/share/doc/packages/rzsz/ChangeLog
/usr/share/doc/packages/rzsz/NEWS
/usr/share/doc/packages/rzsz/README.cvs
/usr/share/doc/packages/rzsz/README.gettext
/usr/share/doc/packages/rzsz/README.isdn4linux
/usr/share/doc/packages/rzsz/README.tests
/usr/share/doc/packages/rzsz/THANKS
/usr/share/doc/packages/rzsz/TODO
/usr/share/man/man1/rz.1.gz
/usr/share/man/man1/sz.1.gz
4、查看软件包的配置文件(若没有,则标准输出就为空)
#rpm -qpc rpm包
示例:
suse11sp3-1:~ # rpm -qpc rzsz-0.12.20-934.22.x86_64.rpm
5、查看软件包的依赖关系
#rpm -qpR rpm包
示例:
suse11sp3-1:~ # rpm -qpR rzsz-0.12.20-934.22.x86_64.rpm
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(CompressedFileNames) <= 3.0.4-1
libc.so.6()(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.3.4)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libc.so.6(GLIBC_2.7)(64bit)
libc.so.6(GLIBC_2.8)(64bit)
libnsl.so.1()(64bit)
rpmlib(PayloadIsLzma) <= 4.4.2-1