I always put a comment at the beginning of nontrivial commands, so accidentally hitting enter prematurely doesn't do anything and so I can check it once it's written out before removing the comment and hitting enter.
Linkers and Loaders by John Levine is not exclusively about Linux, but it does a great job of walking you through in great detail common formats for executables on Linux and the work it takes to get a program running. The manuscript chapters are available at http://www.iecc.com/linker/. I loved the book so much I bought a hard copy.
Common programming idioms, for example iteration, are hard to express in a SQL query, and I think if you try to force iterative ideas on this declarative language the result is frustration or fear.
The need to be able to express yourself iteratively was a motivator for Microsoft's DryadLINQ - a programming language for distributed computation that has SQL-like constructs integrated into C#, giving you a high-level language with some of the declarative benefits as well as some of the imperative benefits (including more natural ways to express iteration).