linux的shell命令源码在哪能找到?比如find的源码

一、rpm -qif `which find` | grep "Source RPM" | awk '{print $NF}'

[root@saltstack ~]# rpm -qif `which find` | grep "Source RPM" | awk '{print $NF}' 
findutils-4.5.11-5.el7.src.rpm

二、去rpmfind.net搜索关键字findutils

 

三、下载findutils-4.5.11-6.el7.src.rpm

 

 四、上传、查看源码包

[root@ceph-1 shell]# rz -y
[root@ceph-1 shell]# ls
findutils-4.5.11-6.el7.src.rpm
[root@ceph-1 shell]# rpm2cpio findutils-4.5.11-6.el7.src.rpm| cpio -idv 
findutils-4.4.0-no-locate.patch
findutils-4.4.2-autofs.patch
findutils-4.4.2-xautofs.patch
findutils-4.5.11-bz1116237.patch
findutils-4.5.11-fd-leak.patch
findutils-4.5.11-ppc-gnulib-tests.patch
findutils-4.5.11.tar.gz
findutils-4.5.7-warnings.patch
findutils.spec
6181 blocks
[root@ceph-1 shell]# ls
 findutils-4.4.0-no-locate.patch  findutils-4.5.11-6.el7.src.rpm    findutils-4.5.11-ppc-gnulib-tests.patch  findutils.spec 
 findutils-4.4.2-autofs.patch     findutils-4.5.11-bz1116237.patch  findutils-4.5.11.tar.gz                  
 findutils-4.4.2-xautofs.patch    findutils-4.5.11-fd-leak.patch    findutils-4.5.7-warnings.patch           
[root@ceph-1 shell]# tar xf findutils-4.5.11.tar.gz
[root@ceph-1 shell]# ls
findutils-4.5.11                 findutils-4.5.11-ppc-gnulib-tests.patch
findutils-4.4.0-no-locate.patch  findutils-4.5.11-6.el7.src.rpm    findutils-4.5.11.tar.gz 
findutils-4.4.2-autofs.patch     findutils-4.5.11-bz1116237.patch  findutils-4.5.7-warnings.patch
findutils-4.4.2-xautofs.patch    findutils-4.5.11-fd-leak.patch    findutils.spec
[root@ceph-1 shell]# cd findutils-4.5.11/
[root@ceph-1 findutils-4.5.11]# ll
total 2264
-rw-r--r-- 1 root root   93787 Nov 18  2012 ABOUT-NLS
-rw-r--r-- 1 root root   44337 Feb  2  2013 aclocal.m4
-rw-r--r-- 1 root root    1331 Nov 17  2012 AUTHORS
drwxr-xr-x 3 root root    4096 Feb  2  2013 build-aux
-rw-r--r-- 1 root root  411052 Feb  2  2013 ChangeLog
-rw-r--r-- 1 root root   91938 Feb  2  2013 config.h.in
-rwxr-xr-x 1 root root 1294667 Feb  2  2013 configure
-rw-r--r-- 1 root root    8331 Feb  2  2013 configure.ac
-rw-r--r-- 1 root root   35068 Aug 21  2011 COPYING
drwxr-xr-x 2 root root    4096 Feb  2  2013 doc
drwxr-xr-x 3 root root     328 Feb  2  2013 find
drwxr-xr-x 4 root root      65 Feb  2  2013 gl
-rw-r--r-- 1 root root    4573 Dec 15  2012 GNUmakefile
-rw-r--r-- 1 root root    2376 Feb  2  2013 import-gnulib.config
-rwxr-xr-x 1 root root   11410 Nov 17  2012 import-gnulib.sh
-rw-r--r-- 1 root root   15578 Nov 18  2012 INSTALL
drwxr-xr-x 2 root root    4096 Feb  2  2013 lib
drwxr-xr-x 3 root root     252 Feb  2  2013 locate
drwxr-xr-x 2 root root     185 Feb  2  2013 m4
-rw-r--r-- 1 root root   62820 Dec 15  2012 maint.mk
-rw-r--r-- 1 root root    2142 Nov 17  2012 Makefile.am
-rw-r--r-- 1 root root   70020 Feb  2  2013 Makefile.in
-rw-r--r-- 1 root root   68339 Feb  2  2013 NEWS
drwxr-xr-x 2 root root    4096 Feb  2  2013 po
-rw-r--r-- 1 root root    3177 Nov 17  2012 README
-rw-r--r-- 1 root root    1049 Nov 17  2012 README-alpha
-rw-r--r-- 1 root root    7541 Nov 17  2012 README-hacking
-rw-r--r-- 1 root root      10 Aug 21  2011 stamp-h.in
drwxr-xr-x 4 root root   12288 Feb  2  2013 tests
-rw-r--r-- 1 root root    1418 Nov 13  2012 THANKS
-rw-r--r-- 1 root root    3084 Nov 17  2012 TODO
-rw-r--r-- 1 root root    1968 Feb  2  2013 tool-versions.txt
drwxr-xr-x 3 root root      91 Feb  2  2013 xargs
[root@ceph-1 findutils-4.5.11]# cd find/
[root@ceph-1 find]# ll
total 524
-rw-r--r-- 1 root root 19855 Feb  2  2013 defs.h
-rw-r--r-- 1 root root  9645 Feb  2  2013 exec.c
-rw-r--r-- 1 root root 62856 Nov 17  2012 find.1
-rw-r--r-- 1 root root 43590 Feb  2  2013 find.c
-rw-r--r-- 1 root root  1094 Nov 17  2012 finddata.c
-rw-r--r-- 1 root root  7489 Nov 17  2012 fstype.c
-rw-r--r-- 1 root root   873 Nov 17  2012 ftsfind.1
-rw-r--r-- 1 root root 19264 Feb  2  2013 ftsfind.c
-rw-r--r-- 1 root root  2440 Nov 17  2012 Makefile.am
-rw-r--r-- 1 root root 75571 Feb  2  2013 Makefile.in
-rw-r--r-- 1 root root   877 Nov 17  2012 oldfind.1
-rw-r--r-- 1 root root 99771 Nov 17  2012 parser.c
-rw-r--r-- 1 root root 35248 Nov 17  2012 pred.c
-rw-r--r-- 1 root root 34672 Feb  2  2013 print.c
-rw-r--r-- 1 root root   387 Nov 17  2012 print.h
-rw-r--r-- 1 root root  4278 Nov 17  2012 sharefile.c
-rw-r--r-- 1 root root  1048 Nov 17  2012 sharefile.h
drwxr-xr-x 5 root root   264 Feb  2  2013 testsuite
-rw-r--r-- 1 root root 46874 Nov 17  2012 tree.c
-rw-r--r-- 1 root root 27761 Feb  2  2013 util.c
[root@ceph-1 find]# vim find.c

  

原文地址:https://www.cnblogs.com/luoahong/p/11934209.html