如何找到linux命令的源代码

比如想找到ls, cat, grep, less等这些工具的源代码观摩学习一下,虽然google一下什么都能找到,但使用软件包管理工具则更为方便。以cat的源代码为例:
[whb@jcwkyl keyan]$ which cat
/bin/cat
[whb@jcwkyl keyan]$ rpm -qif /bin/cat
Name        : coreutils                    Relocations: (not relocatable)
Version     : 5.97                              Vendor: CentOS
Release     : 14.el5                        Build Date: Sat 24 May 2008 11:19:56 PM CST
Install Date: Tue 03 Nov 2009 03:18:40 AM CST      Build Host: builder10.centos.org
Group       : System Environment/Base       Source RPM: coreutils-5.97-14.el5.src.rpm
Size        : 9021731                          License: GPLv2+
Signature   : DSA/SHA1, Sun 15 Jun 2008 07:29:51 AM CST, Key ID a8a447dce8562897
URL         : http://www.gnu.org/software/coreutils/
Summary     : The GNU core utilities: a set of 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.
由上可以看到cat是coreutils中的一个工具。它的主页在http://www.gnu.org/software/coreutils/,于是可以去这个地址下载到coreutils的源代码,然后在其中找到cat
命令的源码。或者去google code上搜索一下cat coreutils。
另外:rpm的命令行参数在它的man文档中有非常清晰的归类,共有query, verify, install, upgrade, remove五大类,每一类操作提供的选项也非常明白。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值