Centos6 查找命令的原始安装包名称

CentOS 6.0上你运行setup命令时出现以下错误:

-bash: setup: command not found

你的第一反应是yum install setup,会得出以下内容:

# yum install setup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.163.com
 * updates: mirrors.163.com
Setting up Install Process
Package setup-2.8.14-10.el6.noarch already installed and latest version
Nothing to do

那这个setup包是我们想要的吗?你运行rpm -ql setup 一看没有setup命令

# rpm -ql setup
/etc/aliases
/etc/bashrc
/etc/csh.cshrc
/etc/csh.login
/etc/environment
/etc/exports
/etc/filesystems
/etc/fstab
/etc/group
/etc/gshadow
/etc/host.conf
/etc/hosts
/etc/hosts.allow
/etc/hosts.deny
/etc/inputrc
/etc/motd
/etc/mtab
/etc/passwd
/etc/printcap
/etc/profile
/etc/profile.d
/etc/protocols
/etc/securetty
/etc/services
/etc/shadow
/etc/shells
/usr/share/doc/setup-2.8.14
/usr/share/doc/setup-2.8.14/COPYING
/usr/share/doc/setup-2.8.14/uidgid
/var/log/lastlog

那怎么办呢?

你可以使用 yum provides or yum what provides 命令来查找setup的原始安装包叫什么名字。

# yum whatprovides /usr/bin/setup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.163.com
 * updates: mirrors.163.com
setuptool-1.19.9-3.el6.x86_64 : A text mode system configuration tool
Repo        : base
Matched from:
Filename    : /usr/bin/setup

setuptool-1.19.9-3.el6.x86_64 : A text mode system configuration tool
Repo        : installed
Matched from:
Other       : Provides-match: /usr/bin/setup

当然参数要是命令的绝对路径哦。