How can I get the source code for the linux utility tail?
this command is really very useful but where I can get the source code to see what is going on inside .
thanks .
The tail utility is part of the coreutils on linux.
- Source tarball: ftp://ftp.gnu.org/gnu/coreutils/coreutils-7.4.tar.gz
- Source file: http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/tail.c
I've always found FreeBSD to have far clearer source code than the gnu utilities. So here's tail.c in the FreeBSD project:
- http://svnweb.freebsd.org/csrg/usr.bin/tail/tail.c?view=markup
Poke around the uclinux site. Since they distributed the software, they are required to make the source available one way or another.
Or, you could read man fseek
and guess at how it might be done.
NB-- See William's comments below, there are cases when you can't use seek.