rpm -qf 的使用技巧,以及如何查找软件包

来源:互联网 发布:山东 知满天面试怎么样 编辑:程序博客网 时间:2024/05/06 02:50

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

rpm  (-qa)| grep 软件名

root@mode oldboy]# rpm -qa| grep opensslopenssl-devel-0.9.8e-22.el5openssl-0.9.8e-22.el5openssl-0.9.8e-22.el5openssl-devel-0.9.8e-22.el5[root@mode oldboy]# yum search opensslLoaded plugins: fastestmirror, securityLoading mirror speeds from cached hostfilefile:///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 scriptsopenssl.i686 : The OpenSSL toolkitopenssl.x86_64 : The OpenSSL toolkitopenssl-devel.i386 : Files for development of applications which will use                   : OpenSSLopenssl-devel.x86_64 : Files for development of applications which will use                     : OpenSSLopenssl-perl.x86_64 : Perl scripts provided with OpenSSLopenssl097a.i386 : The OpenSSL toolkitopenssl097a.x86_64 : The OpenSSL toolkitperl-Crypt-SSLeay.x86_64 : Crypt::SSLeay - OpenSSL glue that provides LWP https                         : supportperl-Net-SSLeay.x86_64 : Perl extension for using OpenSSLpyOpenSSL.x86_64 : Python wrapper module around the OpenSSL libraryxmlsec1.i386 : Library providing support for "XML Signature" and "XML             : Encryption" standardsxmlsec1.x86_64 : Library providing support for "XML Signature" and "XML               : Encryption" standardsxmlsec1-openssl.i386 : OpenSSL crypto plugin for XML Security Libraryxmlsec1-openssl.x86_64 : OpenSSL crypto plugin for XML Security Libraryxmlsec1-openssl-devel.i386 : OpenSSL crypto plugin for XML Security Libraryxmlsec1-openssl-devel.x86_64 : OpenSSL crypto plugin for XML Security Librar


如果在生产环境中,系统的重要文件/etc/inittab被删除了(系统还没重启,崩溃前),不要急,下面告诉你该如何处理。1、模拟误删除文件[root@localhost ~]# rm -rf /etc/inittab[root@localhost ~]# cat /etc/inittabcat: /etc/inittab: No such file or directory2、新建该文件,并查看对应包的相关信息[root@localhost ~]# touch /etc/inittab[root@localhost ~]# rpm -qf /etc/inittabinitscripts-8.45.19.EL-1 3、确定了包的相关信息,挂载安装光盘,进行查找[root@localhost ~]# cd /mnt/yum/[root@localhost yum]# lltotal 0[root@localhost yum]# cd ~[root@localhost ~]# mount /dev/cdrom /mnt/yummount: 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 /tmpcp: overwrite `/tmp/initscripts-8.45.30-2.el5.i386.rpm'? y[root@localhost Server]# cd /tmp[root@localhost tmp]# lltotal 1680drwx------ 2 root root    4096 Feb 17 13:45 bindrwx------ 9 root root    4096 Feb 17 13:45 etcdrwx------ 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.rpmdrwx------ 2 root root    4096 Feb 17 13:53 keyring-06YG9Fdrwx------ 2 root root    4096 Sep 26 08:44 keyring-elqVM1drwx------ 2 root root    4096 Sep 26 08:08 keyring-jTNbTbdrwx------ 3 root root    4096 Feb 17 13:45 libsrwxr-xr-x 1 root root       0 Feb 17 13:54 mapping-rootdrwx------ 2 root root    4096 Feb 17 15:38 orbit-rootdrwx------ 2 root root    4096 Feb 17 13:45 sbindrwx------ 2 root root    4096 Feb 17 13:53 ssh-ROxTuK6949drwx------ 4 root root    4096 Feb 17 13:45 usrdrwx------ 4 root root    4096 Feb 17 13:45 vardrwx------ 2 root root    4096 Feb 17 13:54 virtual-root.2eelUVdrwxrwxrwt 2 root root    4096 Feb  5 12:19 VMwareDnDdrwx------ 2 root root    4096 Feb 17 13:53 vmware-root 4、解压包的信息[root@localhost tmp]# rpm2cpio initscripts-8.45.30-2.el5.i386.rpm |cpio -imd10748 blocks[root@localhost tmp]# lltotal 1680drwx------ 2 root root    4096 Feb 17 13:45 bindrwx------ 9 root root    4096 Feb 17 13:45 etcdrwx------ 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.rpmdrwx------ 2 root root    4096 Feb 17 13:53 keyring-06YG9Fdrwx------ 2 root root    4096 Sep 26 08:44 keyring-elqVM1drwx------ 2 root root    4096 Sep 26 08:08 keyring-jTNbTbdrwx------ 3 root root    4096 Feb 17 13:45 libsrwxr-xr-x 1 root root       0 Feb 17 13:54 mapping-rootdrwx------ 2 root root    4096 Feb 17 15:38 orbit-rootdrwx------ 2 root root    4096 Feb 17 13:45 sbindrwx------ 2 root root    4096 Feb 17 13:53 ssh-ROxTuK6949drwx------ 4 root root    4096 Feb 17 13:45 usrdrwx------ 4 root root    4096 Feb 17 13:45 vardrwx------ 2 root root    4096 Feb 17 13:54 virtual-root.2eelUVdrwxrwxrwt 2 root root    4096 Feb  5 12:19 VMwareDnDdrwx------ 2 root root    4096 Feb 17 13:53 vmware-root5、进行文件替换与简单修改[root@localhost tmp]# cp ./etc/inittab /etc/cp: overwrite `/etc/inittab'? y[root@localhost tmp]# cat /etc/inittab收工!!!!!!!

 yum search 软件名

rpm -qf 软件名


0 0