View Full Version : Source code for tail, vmstat, iostat

March 8th, 2009, 03:47 PM

These commands are very useful but where do I get to look at the source code to see what's going on? Thanks. /Adam

March 8th, 2009, 04:09 PM
me@myComputer:$ whereis tail
tail: /usr/bin/tail /usr/share/man/man1/tail.1.gz

Visit packages.ubuntu.com. Select "Search the contents of packages" and paste "tail". Hit search and find the package "coreutils". Click on it to see the description. Then go to some newly made directory and download the source using apt-get (for this operation, no sudo rights are necessary):

apt-get source coreutils

Repeat this procedure for the other programs.

March 8th, 2009, 05:09 PM
Very helpful, and so easy. Thank you!

I was searching with the help of Google. Didn't find much.

March 8th, 2009, 08:41 PM
dpkg -S $(whereis tail | python -c "print open(\"/dev/stdin\").read().split()[1]")

March 8th, 2009, 10:40 PM
Or, doing it all from the terminal:

$ which tail
$ dpkg -S /usr/bin/tail
coreutils: /usr/bin/tail
$ apt-get source coreutils