
Master Bash fundamentals and shell scripting basics, combining the Bash language with Linux commands, while learning to read manuals and study alone to become an intermediate shell programmer.
Discover how Bash, a user-level shell accessed through a terminal emulator, processes commands, uses piping and options, and supports scripts, variables, loops, and conditionals.
pwd, ls, cd, echo; tilde (~), .. and .
Explore basic Bash concepts like variables, pipes, filters, and aliases, and see how to use less, more, and tree to view commands and the filesystem.
Explore basic linux commands by creating directories and files with mkdir, touch, and echo redirection, viewing with cat, and removing with rm and rmdir, while avoiding root privileges.
learn how to read ls -l output and interpret file types and permissions, including user, group, and others, and use chmod to modify rights and make scripts executable.
Learn to use wc -l to count lines, wc -w for words, and wc -c for characters, piping from commands like ls and find to count items.
metacharacters: | & ; < > space tab newline
and: ~ $ #
strong quoting - single quotes protect everything between them from the shell
weak quoting - double quotes protect everything except the $, the backslash (\) and (not so relevant) the back quotes (``)
backslash - protects the next character from the shell
(Not so) special case: Filenames and strings containing spaces (and potentially) other weird characters.
Learn command substitution in Bash by capturing output with $(seq 1 3). Use cut and sleep to format results and drive simple arithmetic in for loops.
simple commands, control operators: || & && ; ;; ;& ;;& | |& <newline>
brace expansion, tilde expansion, parameter/variable expansion, command substitution, arithmetic expansion, filename expansion, quote removal
Every program:
- reads input from its standard input channel (stdin, 0 - usually the keyboard),
- writes its output to the standard output channel (stdout, 1 - usually the screen)
- sends error messages to the standard error channel (stderr, 2 - usually also the screen).
All channels can be directed elsewhere (or even closed).
Pipes and other redirections in action. Use |& to redirect both stdout and stderr into a pipeline.
Explore how the tr command translates and replaces characters using set1 and set2, and learn to delete with -d, squeeze with -s, and perform case conversion with [:lower:] and [:upper:].
Tackle a five piece bash puzzle by creating a greeting file and using cat greeting and tr -d to remove ŗ and carriage return characters.
Obfuscate text by mapping SET1 to SET2 with tr, then shuffle SET2 with shuf after folding SET1 into single characters with fold, and remove newlines with tr -d.
Transform a text into a non-readable form using set1, set2, and tr, then recover it by swapping sets. Validate identity with diff and practice command substitution, piping, and vi.
Master the logic of bash command lines by studying the logical and or operators (&&, ||), truth tables, and left-to-right evaluation with file examples.
The lecture explains how the shell evaluates a list of commands with && and ||, computing the overall truth value and short-circuiting by skipping unnecessary commands.
Learn how the shell uses the exit status to signal success when it is 0 and failure, with the last command in a list or pipeline determining the overall status.
Demonstrate using and or in bash to control command flow by prior success, with true and echo, and show the test command for file existence with silent redirection.
Demonstrate grep, a Linux utility that searches text lines for patterns via regular expressions. Use -n, -i, -v, and -f to filter input files or piped input and display matches.
Learn to write bash shell scripts, include a shebang, locate bash with which, and execute scripts via bash, source, or by making them executable with proper exit statuses.
You'll finish this course with a solid grasp on the Bash shell, it's programming environment and syntax. In addition you'll learn many essential Linux commands. The course essentially follows the outline of the Bash Reference Manual and the Bash manual page but it's easier to follow due to a hands-on approach and many examples.