Chapter Three
The Shell
How Bash reads a command line, the expansions it runs before any program starts, and the control over input, output, variables, and jobs that turns a prompt into a tool.
The shell is the program that turns a line of text into running processes. On Debian and Ubuntu the interactive default is Bash, and most of what people call "the command line" is really Bash applying a fixed sequence of rules — splitting words, expanding patterns and variables, wiring up input and output — before a single binary ever executes. The commands you run are the small part; the shell's processing around them is the part that bites.
This chapter takes Bash apart in the order it actually works. It starts with how a command line is parsed and what a builtin is, moves through the expansions and globbing that rewrite your words behind your back, then covers redirection and pipes, the quoting that decides which of those expansions fire, the variables and environment that processes inherit, and finally job control and history. Get these six right and most "why did that not do what I typed" surprises disappear.
Topics in This Chapter
*.txt is expanded by the shell, not the command, and what happens when nothing matches.>, 2>, and &>, and chaining processes through pipes. Where 2>&1 has to go and why pipeline exit status surprises people.jobs, bg, fg, and disown. Plus command history expansion and why a backgrounded job still dies on logout unless you detach it.