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: https://git.savannah.gnu.org/cgit/coreutils.git/tree/src/tail.c (original http link)
I’ve always found FreeBSD to have far clearer source code than the gnu utilities. So here’s tail.c in the FreeBSD project: