下面以获取cat命令的源代码为例说明:
运行命令:rpm -qif `which cat`
显示信息如下:
[root@lsy programming]# rpm -qif `which cat`
Name : coreutils Relocations: (not relocatable)
Version : 8.4 Vendor: CentOS
Release : 19.el6_4.1 Build Date: Thu 04 Apr 2013 03:59:03 PM CST
Install Date: Mon 15 Apr 2013 11:13:54 PM CST Build Host: c6b9.bsys.dev.centos.org
Group : System Environment/Base Source RPM: coreutils-8.4-19.el6_4.1.src.rpm
Size : 12634548 License: GPLv3+
Signature : RSA/SHA1, Fri 05 Apr 2013 05:02:35 AM CST, Key ID 0946fca2c105b9de
Packager : CentOS BuildSystem <http://bugs.centos.org>
URL : http://www.gnu.org/software/coreutils/
Summary : A set of basic GNU tools commonly used in shell scripts
Description :
These are the GNU core utilities. This package is the combination of
the old GNU fileutils, sh-utils, and textutils packages.
通过以上信息,可以到网址上取下在.tar.gz的包(http://www.gnu.org/software/coreutils/)
然后解压此包,所有命令的源码都在解压目录下一个叫src的文件夹下。