Glossary

Regular expression

A pattern language for matching text, used by grep, sed and awk.

Regular expressions describe text patterns: ^ anchors the start of a line, $ the end, . matches any character, * repeats the previous element, [0-9] a digit, | alternation. grep, sed and awk are built around them.

They are not globs, despite sharing symbols: in a glob * means "any characters", in a regex it means "zero or more of the previous thing". Mixing the two mental models is a classic source of confusion.

See it in practice

$ grep -E "^(error|warn):" app.log

Anchored to the line start, matching either word. Extended regex (-E) enables the parentheses and pipe without escaping.

Where you'll meet it

grep

Find lines matching a pattern in files or piped input — the workhorse of text search.

sed

Stream-edit text: substitute, delete lines, and edit files in place with -i.

awk

Pull columns out of any output, filter rows, and compute sums — the shell's spreadsheet.

Glob (wildcard)

Patterns like *.txt, expanded by the shell before the command runs.

Learn these concepts by typing them: the interactive course builds them up lesson by lesson in a real simulated shell.