Linux小技巧:rpm -qf ——查看文件或命令属于哪个安装包的内容(附带rpm常用命令)

版权声明:作者-傲娇天子 博文主页地址:https://blog.csdn.net/qq_41116956 欢迎转载,转载请在文章页面明显位置给出原文链接,谢谢 https://blog.csdn.net/qq_41116956/article/details/82801115

rpm命令的用法有很多,这里简单列举一下:

查询是否安装某个软件:

[root@localhost 1]# rpm -qa | grep vim
vim-filesystem-7.4.160-1.el7.x86_64
vim-enhanced-7.4.160-1.el7.x86_64
vim-common-7.4.160-1.el7.x86_64
vim-minimal-7.4.160-1.el7.x86_64

查询命令属于哪个软件:

[root@localhost 1]# which passwd 
/usr/bin/passwd
[root@localhost 1]# rpm -qf /usr/bin/passwd
passwd-0.79-4.el7.x86_64

查询文件:

[root@localhost 1]# rpm -qf /usr/bin/
filesystem-3.2-20.el7.x86_64

查询RPM的详细信息:

[root@localhost 1]# rpm -qpi /mnt/Packages/filesystem-3.2-20.el7.x86_64.rpm 
......
Summary     : The basic directory layout for a Linux system
Description :
The filesystem package is one of the basic packages that is installed
on a Linux system. Filesystem contains the basic directory layout
for a Linux operating system, including the correct permissions for
the directories.

rpm卸载:

c^C[root@localhost 1]# rpm -qa | grep ssh
openssh-clients-6.6.1p1-22.el7.x86_64
openssh-server-6.6.1p1-22.el7.x86_64
libssh2-1.4.3-10.el7.x86_64
openssh-6.6.1p1-22.el7.x86_64
[root@localhost 1]# rpm -e libssh2
错误:依赖检测失败:
	libssh2(x86-64) >= 1.4.3 被 (已安裝) libcurl-7.29.0-25.el7.centos.x86_64 需要
	libssh2.so.1()(64bit) 被 (已安裝) libcurl-7.29.0-25.el7.centos.x86_64 需要
	libssh2.so.1()(64bit) 被 (已安裝) qemu-img-10:1.5.3-105.el7.x86_64 需要
	libssh2.so.1()(64bit) 被 (已安裝) qemu-kvm-10:1.5.3-105.el7.x86_64 需要
[root@localhost 1]# rpm -e --nodeps libssh2
#忽略依赖关系卸载

猜你喜欢

转载自blog.csdn.net/qq_41116956/article/details/82801115