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

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
#忽略依赖关系卸载

 

  • 5
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值