Download the source of coreutils from http://www.gnu.org/software/coreutils/ and get started.
Get the source of bash http://ftp.gnu.org/gnu/bash/ (or other shell) and you can read the bash source.
You may want to read any Linux system programming book to read about the system calls API and know how to use them. Here is a link to unix.stackexchange:
What is the best book to learn Linux system programming?
The working of the Linux OS and working of the commands are different things. If you already know OS basics then you can try reading Understanding The Linux Kernels by Daniel Bovet. Else I think you might want to first read a standard OS book by Galvin, Tanenbaum or Deitel or any other book.