[vagrant@localhost ~]$ sudo yum shell
Loaded plugins: fastestmirror
Setting up Yum Shell
> search vim-common
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.stuhome.net
* updates: mirrors.btte.net
N/S Matched: vim-common ==============================================================================vim-common.x86_64 : The common files needed by any version of the VIM editor
[vagrant@localhost ~]$ sudo yum history info 3
Loaded plugins: fastestmirror
Transaction ID : 3
Begin time : Sat Mar 9 15:50:00 2013
Begin rpmdb : 239:6f5a8ecd22e6f0a663940801ef56d66b2ad40228
End time : 15:50:07 2013(7 seconds)End rpmdb : 255:92e8267085fc364911baebaf646b14856fb20498
User : <veewee>
Return-Code : Success
Command Line : -y install puppet facter
Transaction performed with:
Installed rpm-4.8.0-32.el6.x86_64 @anaconda-CentOS-201303020151.x86_64/6.4
Installed yum-3.2.29-40.el6.centos.noarch @anaconda-CentOS-201303020151.x86_64/6.4
Installed yum-plugin-fastestmirror-1.1.30-14.el6.noarch @anaconda-CentOS-201303020151.x86_64/6.4
Packages Altered:
Dep-Install augeas-libs-0.9.0-4.el6.x86_64 @base
Dep-Install compat-readline5-5.2-17.1.el6.x86_64 @base
Dep-Install dmidecode-1:2.11-2.el6.x86_64 @base
Install facter-1:1.6.17-1.el6.x86_64 @puppetlabs
Dep-Install hiera-1.1.2-1.el6.noarch @puppetlabs
...
既然可以记录Transaction,那么势必也会提供undo和redo的功能:
12
sudo yum history undo 7#将Transaction 7中安装的所有软件都删除 sudo yum history redo 8#将Transaction 7中删除的软件重新安装
对于系统管理员来说,这应该算得上是个比较有用的命令。前面提到yum的交易记录数据库文件保存在 /var/lib/yum/history/下面,如果想将Transction记录到新的db文件中,可以用yum history new,它会清空/var/lib/yum/history/目录,然后新建db文件。想打开某个history记录文件可以用yum load-transaction file_name。
yum provides : 通过软件安装后的可执行文件,反查安装它的package
1234567891011121314151617
vagrant@localhost ~]$ yum provides /usr/bin/vim
1:vim-enhanced-7.2.411-1.8.el6.x86_64 : A version of the VIM editor which includes recent enhancements
Repo : installed
Matched from:
Other : Provides-match: /usr/bin/vim
[vagrant@localhost ~]$ yum provides wget
wget-1.12-1.8.el6.x86_64 : A utility for retrieving files using the HTTP or FTP protocols
Repo : installed
Matched from:
Other : Provides-match: wget
[vagrant@localhost ~]$ yum provides /*/vi
1:vim-minimal-7.2.411-1.8.el6.x86_64 : A minimal version of the VIM editor
Repo : installed
Matched from:
Other : Provides-match: /bin/vi