首先查看安装的软件包,或者时候安装有某某软件包的命令

rpm  (-qa)| grep 软件名

root@mode oldboy]# rpm -qa| grep openssl
openssl-devel-0.9.8e-22.el5
openssl-0.9.8e-22.el5
openssl-0.9.8e-22.el5
openssl-devel-0.9.8e-22.el5
[root@mode oldboy]# yum search openssl
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
file:///mnt/cdrom/repodata/repomd.xml: [Errno 5] OSError: [Errno 2] No such file or directory: '/mnt/cdrom/repodata/repomd.xml'
Trying other mirror.
=============================== Matched: openssl ===============================
m2crypto.x86_64 : Support for using OpenSSL in python scripts
openssl.i686 : The OpenSSL toolkit
openssl.x86_64 : The OpenSSL toolkit
openssl-devel.i386 : Files for development of applications which will use
: OpenSSL
openssl-devel.x86_64 : Files for development of applications which will use
: OpenSSL
openssl-perl.x86_64 : Perl scripts provided with OpenSSL
openssl097a.i386 : The OpenSSL toolkit
openssl097a.x86_64 : The OpenSSL toolkit
perl-Crypt-SSLeay.x86_64 : Crypt::SSLeay - OpenSSL glue that provides LWP https
: support
perl-Net-SSLeay.x86_64 : Perl extension for using OpenSSL
pyOpenSSL.x86_64 : Python wrapper module around the OpenSSL library
xmlsec1.i386 : Library providing support for "XML Signature" and "XML
: Encryption" standards
xmlsec1.x86_64 : Library providing support for "XML Signature" and "XML
: Encryption" standards
xmlsec1-openssl.i386 : OpenSSL crypto plugin for XML Security Library
xmlsec1-openssl.x86_64 : OpenSSL crypto plugin for XML Security Library
xmlsec1-openssl-devel.i386 : OpenSSL crypto plugin for XML Security Library
xmlsec1-openssl-devel.x86_64 : OpenSSL crypto plugin for XML Security Librar

假设在生产环境中,系统的关键文件/etc/inittab被删除了(系统还没重新启动。崩溃前),不要急。以下告诉你该怎样处理。
1、模拟误删除文件
[root@localhost ~]# rm -rf /etc/inittab
[root@localhost ~]# cat /etc/inittab
cat: /etc/inittab: No such file or directory
2、新建该文件,并查看相应包的相关信息
[root@localhost ~]# touch /etc/inittab
[root@localhost ~]# rpm -qf /etc/inittab
initscripts-8.45.19.EL-1 3、确定了包的相关信息,挂载安装光盘,进行查找
[root@localhost ~]# cd /mnt/yum/
[root@localhost yum]# ll
total 0
[root@localhost yum]# cd ~
[root@localhost ~]# mount /dev/cdrom /mnt/yum
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@localhost ~]# cd /mnt/yum/Server/
[root@localhost Server]# cp initscripts-8.45.30-2.el5.i386.rpm /tmp
cp: overwrite `/tmp/initscripts-8.45.30-2.el5.i386.rpm'? y
[root@localhost Server]# cd /tmp
[root@localhost tmp]# ll
total 1680
drwx------ 2 root root 4096 Feb 17 13:45 bin
drwx------ 9 root root 4096 Feb 17 13:45 etc
drwx------ 3 root root 4096 Feb 17 13:53 gconfd-root
-r--r--r-- 1 root root 1651907 Feb 17 15:41 initscripts-8.45.30-2.el5.i386.rpm
drwx------ 2 root root 4096 Feb 17 13:53 keyring-06YG9F
drwx------ 2 root root 4096 Sep 26 08:44 keyring-elqVM1
drwx------ 2 root root 4096 Sep 26 08:08 keyring-jTNbTb
drwx------ 3 root root 4096 Feb 17 13:45 lib
srwxr-xr-x 1 root root 0 Feb 17 13:54 mapping-root
drwx------ 2 root root 4096 Feb 17 15:38 orbit-root
drwx------ 2 root root 4096 Feb 17 13:45 sbin
drwx------ 2 root root 4096 Feb 17 13:53 ssh-ROxTuK6949
drwx------ 4 root root 4096 Feb 17 13:45 usr
drwx------ 4 root root 4096 Feb 17 13:45 var
drwx------ 2 root root 4096 Feb 17 13:54 virtual-root.2eelUV
drwxrwxrwt 2 root root 4096 Feb 5 12:19 VMwareDnD
drwx------ 2 root root 4096 Feb 17 13:53 vmware-root 4、解压包的信息
[root@localhost tmp]# rpm2cpio initscripts-8.45.30-2.el5.i386.rpm |cpio -imd
10748 blocks
[root@localhost tmp]# ll
total 1680
drwx------ 2 root root 4096 Feb 17 13:45 bin
drwx------ 9 root root 4096 Feb 17 13:45 etc
drwx------ 3 root root 4096 Feb 17 13:53 gconfd-root
-r--r--r-- 1 root root 1651907 Feb 17 15:41 initscripts-8.45.30-2.el5.i386.rpm
drwx------ 2 root root 4096 Feb 17 13:53 keyring-06YG9F
drwx------ 2 root root 4096 Sep 26 08:44 keyring-elqVM1
drwx------ 2 root root 4096 Sep 26 08:08 keyring-jTNbTb
drwx------ 3 root root 4096 Feb 17 13:45 lib
srwxr-xr-x 1 root root 0 Feb 17 13:54 mapping-root
drwx------ 2 root root 4096 Feb 17 15:38 orbit-root
drwx------ 2 root root 4096 Feb 17 13:45 sbin
drwx------ 2 root root 4096 Feb 17 13:53 ssh-ROxTuK6949
drwx------ 4 root root 4096 Feb 17 13:45 usr
drwx------ 4 root root 4096 Feb 17 13:45 var
drwx------ 2 root root 4096 Feb 17 13:54 virtual-root.2eelUV
drwxrwxrwt 2 root root 4096 Feb 5 12:19 VMwareDnD
drwx------ 2 root root 4096 Feb 17 13:53 vmware-root
5、进行文件替换与简单改动
[root@localhost tmp]# cp ./etc/inittab /etc/
cp: overwrite `/etc/inittab'? y
[root@localhost tmp]# cat /etc/inittab
收工!!!! ! 。!

yum search 软件名

rpm -qf 软件名

rpm -qf 的使用技巧,以及怎样查找软件包的更多相关文章

  1. dpkg -S {file} #ubuntu 14.04 rpm -qf {file} #centos 7

    Linux查找命令或组件对应安装包的方法原创FJEagle 最后发布于2017-12-15 19:10:06 阅读数 4603 收藏展开Linux查找命令或组件对应安装包的方法当新搭建服务器或者维护不 ...

  2. 拾遗:{rpm、yum及源码方式管理软件包}

    一.yum配置文件位置 /etc/yum.conf /etc/yum.repos.d/*.repo 二.yum常用命令 install pkgs reinstall pkgs update pkgs ...

  3. rpm --qf 命令

    1. 环境准备: sudo apt-get install rpm (Ubuntu系统) wget ftp://rpmfind.net/linux/fedora-secondary/developme ...

  4. vs中不得不会的一些小技巧(1)——细说查找

    最近在改公司里面古老的asp代码,不说文件有1w个,起码也有7,8千,而且文件里面include一个嵌套一个...当某天jira平台 上出现了需要你改的bug的时候,甚至都不知道这个错误在哪个页面,更 ...

  5. eclipse使用技巧---使用正则表达式查找替换

    1,Eclipse ctrl+f 打开查找框2,选中 Regular expressions (正则表达式) 去掉/* */(eclipse)        /\*(.|[\r\n])*?\*/去掉/ ...

  6. 数据算法 --hadoop/spark数据处理技巧 --(15.查找、统计和列出大图中的所有三角形 16.k-mer计数)

    十五.查找.统计和列出大图中的所有三角形 第一步骤的mr: 第二部mr: 找出三角形 第三部:去重 spark: 十六: k-mer计数 spark:

  7. POJ 2456 编程技巧之------二分查找思想的巧妙应用

    Aggressive cows Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 18599   Accepted: 8841 ...

  8. centos保存rpm到本地以及使用yum完全卸载软件包

    目录 保存安装的rpm到本地 方法一: 方法二(推荐): yum卸载软件包包括依赖 保存安装的rpm到本地 方法一: [root@ServerA ~]# vim /etc/yum.conf [main ...

  9. ubuntu查找软件包

    sudo apt-cache search s_name

随机推荐

  1. 排序代码(python,c++) 及 基本算法复杂度

    0.导语 本节为手撕代码系列之第一弹,主要来手撕排序算法,主要包括以下几大排序算法: 直接插入排序 冒泡排序 选择排序 快速排序 希尔排序 堆排序 归并排序 1.直接插入排序 [算法思想] 每一步将一 ...

  2. unity 显示、隐藏Android导航栏

    1.下面的返回.home栏可用Screen.fullScreen控制 2.导航栏的显示和隐藏用下面代码控制 private AndroidJavaObject currentActivity { ge ...

  3. C/C++ Quick Sort Algorithm

    本系列文章由 @YhL_Leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/50255069 快速排序算法,由C.A. ...

  4. Qt之命令行参数

    简述 在Qt之进程间通信(QProcess)一节,我们讲解了如何通过QProcess来进行进程间的通信.主要通过启动外部程序,然后通过命令行的方式传递参数. 这里,我们可以通过Qt Creator来设 ...

  5. hdu5389(DP)

    题意: 给出n个人的id,有两个门,每一个门有一个标号.我们记作a和b,如今我们要将n个人分成两组,进入两个门中,使得两部分人的标号的和(迭代的求,直至变成一位数.我们姑且叫做求"和&quo ...

  6. objective-c訪问控制符

    objective-c中成员变量的四个訪问控制符: @private:仅仅有当前类的内部才干訪问 @public:全部人都可訪问 @protected:仅仅限当前类和它的子类可以訪问 @package ...

  7. BZOJ 2005 [Noi2010]能量採集 (容斥)

    [Noi2010]能量採集 Time Limit: 10 Sec  Memory Limit: 552 MB Submit: 2324  Solved: 1387 [id=2005"> ...

  8. cocos2d-x_AnchorPoint锚点

    锚点是定位和变换操作的一个重点.锚点我们能够看成用一根图钉将一张纸或者相片钉在墙上的那个点. 节点的位置是由我们设置的position和anchor point一起决定的. 值得一提的是,anchor ...

  9. _itoa进制转换

    #define _CRT_SECURE_NO_WARNINGS #include <stdlib.h> #include <stdio.h> void main() { int ...

  10. POJ 1275 差分约束

    一堆化不等式,,,,,, 懒得写了... 请看mars_ch的blog-.. 戳戳戳戳戳 还是她给我找的错---. //By SiriusRen #include <queue> #inc ...