Linux 查看命令源码,linux命令源码


一、简介

有时候想看看ls、cat、more等命令的源代码,本文介绍相应查看方法。

 

二、方法

参考:

http://blog.csdn.net/silentpebble/article/details/41279285
http://blog.csdn.net/zhenwo123/article/details/19190189

 

查看uname这个命令的源代码

# whereis uname
uname: /bin/uname /usr/share/man/man1/uname.1.gz /usr/share/man/man2/uname.2.gz /usr/share/man
 
# rpm -qf /bin/uname
coreutils-8.5-7.fc14.i686
 
# yumdownloader --source coreutils-8.5-7.fc14.i686 
 
# rpm2cpio coreutils-8.5-7.fc14.src.rpm | cpio -idv coreutils-8.5.tar.xz

coreutils-8.5.tar.xz

9446 blocks

# tar xjvf coreutils-8.5.tar.xz 

 

三、源码分析

参考:

http://blog.csdn.net/yxc135/article/details/22161907

相关内容