Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1448975
  • 博文数量: 263
  • 博客积分: 10851
  • 博客等级: 上将
  • 技术积分: 2627
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-26 22:40
文章分类

全部博文(263)

文章存档

2013年(4)

2012年(25)

2011年(33)

2010年(50)

2009年(138)

2008年(13)

分类: LINUX

2009-10-16 15:16:46

以在我的FC9上安装iostat这个命令为示例: 因为事先也不知道该命令属于的安装路径
# yum whatprovides /usr/bin/iostat
Loaded plugins: refresh-packagekit
sysstat.i386 : The sar and iostat system monitoring commands
sysstat.i386 : The sar and iostat system monitoring commands
 
问: 如果不知道iostat的绝对路径就是 /usr/bin/iostat该怎么办呢?  man yum发现provides/whatprovides接受通配符选项:
provides or whatprovides
  is  used  to  find  out which package provides some feature or file. Just use a specific name or a file-glob-syntax wildcards to list the packages available or installed that provide that feature or file.
所以试试:
# yum whatprovides *iostat
Loaded plugins: refresh-packagekit
sysstat.i386 : The sar and iostat system monitoring commands
munin-node.noarch : Network-wide graphing framework (node)
sysstat.i386 : The sar and iostat system monitoring commands
根据:后面的描述, 就可以判断安装哪个rpm包了
 
 
根据这个可以得知iostat属于sysstat这个rpm包, 但是因为FC9自带的安装光盘上没有这个rpm包, 所以:
# yum install sysstat
这样就大功告成了。
 
另外, 如果想知道某个系统上已经安装的命令属于哪个rpm包, 可以这样:(以ls命令为例)
# whereis ls    # 找到ls命令安装所在的绝对路径
# rpm -qf /bin/ls
coreutils-6.10-18.fc9.i386   # 这样就可以很快得到某个命令所在的rpm包名了
# rpm -ql coreutils  # 列出这个rpm包中的所有文件
 
# 当然在上寻找答案, 也是较快速的方法之一
阅读(5346) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~