「主要想了解命令的原理,以及打印信息的含义,感觉要搞清楚这些需要理解命令的实现什么的」
去看源码可能是最佳方式,代码就是这些命令的设计理念和实现方式的最形象呈现。
freebsd 下查到
% whereis strace
strace: /usr/ports/devel/strace
% cat /usr/ports/devel/strace/pkg-descr
Strace is a process tracer, i.e. a debugging tool that prints out
a trace of all the system calls made and signals received by a
process itself or a process and its descendants.
Strace is similar to the native BSD ``truss'' utility, but it's
output style is more convenient in most cases.
For strace to work, procfs has to be mounted. FreeBSD does not
mount it by default. For more information, man procfs.
WWW:
http://sourceforge.net/projects/strace/# 以上为strace官网,也能下载到源码包
% whereis pmap
pmap: /usr/ports/sysutils/pmap
cat /usr/ports/sysutils/pmap/pkg-descr
% cat /usr/ports/sysutils/pmap/pkg-descr
pmap is an utility for displaying the address space of a process.
Author: Roman V. Palagin <romanp@unshadow.net>
WWW:
ftp://ftp.wuppy.net.ru/pub/FreeBSD/local/pmap/# 同上
------
以下的都属于freebsd的base system,所以自己下载freebsd官方源码包(
ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/9.0-RELEASE/src.txz) tar和gunzip解压成 src 目录再去对应路径下去找就是了。
% whereis nm
nm: /usr/bin/nm /usr/share/man/en.UTF-8/man1/nm.1.gz /usr/src/gnu/usr.bin/binutils/nm
% whereis objdump
objdump: /usr/bin/objdump /usr/share/man/en.UTF-8/man1/objdump.1.gz /usr/src/gnu/usr.bin/binutils/objdump
% whereis objcopy
objcopy: /usr/bin/objcopy /usr/share/man/en.UTF-8/man1/objcopy.1.gz /usr/src/gnu/usr.bin/binutils/objcopy