Learn

Bash Redirection and File Descriptors

Understand where the bytes go and why redirect order changes the result.

Follow input, output, and file descriptors through 15 chapters of Bash practice. Trace failures, protect reports, and repair a report exporter. This optional course builds on Linux Foundations. Practice feedback is formative and awards no XP or mastery.

15 published lessons across 15 chapters, about 11 hours of work. Every lab runs on a real virtual machine in your browser, and checks your work on the machine itself.

Published chapters and lessons

Follow the descriptors

Trace stdout and stderr through ordered redirects. Separate, merge, and exchange streams while preserving a command’s exit status.

Opening happens before the command runs

Understand why an early output open can empty a file even when a later redirect prevents the command from starting.

Descriptor lifetime and shell scope

Control redirects across commands, groups, functions, subshells, and exec. Restore destinations and close descriptors you own.

A descriptor is not a filename

Compare duplicated descriptors with independent opens. Investigate shared offsets, inheritance, descriptor flags, and open file descriptions.

Here documents as a parsing and expansion boundary

Choose literal or expanded here documents. Understand delimiter quoting and generate shell syntax as data without running it during generation.

Here-document edge cases and binary boundaries

Diagnose multiple here documents, nonzero input descriptors, real tabs, spaces, CRLF, and delimiter boundaries using exact bytes.

Pipes, redirection precedence, and process ownership

Trace pipe setup and explicit redirects. Explain piped loops, subshell state, Bash lastpipe, and the difference between and &.

Status is part of the data contract

Preserve stage failures with PIPESTATUS, pipefail, and wait. Decide when an incomplete report must fail even if its final consumer succeeds.

Here strings, substitutions, and newline fidelity

Compare here strings, command substitution, process substitution, files, and pipes. Preserve required bytes and account for asynchronous failures.

Closing the pipe

Find leaked writers that prevent EOF. Explain SIGPIPE, blocked writers, pipe capacity, and bounded recovery from a stalled process.

Logging without lying

Keep machine-readable stdout separate from diagnostics and traces. Detect tee failures and understand buffering when interpreting merged logs.

Safer file creation and replacement

Quote paths, choose permissions, create private temporary files, validate output, and replace a report only after success.

Concurrency, permissions, and special files

Investigate append races, explicit locks, symlinks, FIFOs, /dev/null, /dev/full, and the difference between failed opens and failed writes.

The terminal and remote boundaries

Identify which process and host opens a file. Preserve SSH loop input and keep terminal prompts out of machine-readable output.

Incident lab: a trustworthy report exporter

Repair a broken exporter that mixes logs, hides failures, and risks its last good report. Explain its before-and-after descriptor routing.

Frequently asked questions

How many published lessons are in Bash Redirection and File Descriptors?

Bash Redirection and File Descriptors has 15 published lessons, roughly 11 hours of guided work, spread across 15 chapters.

Do I need my own server or hardware to do the Bash Redirection and File Descriptors labs?

No. Every lab boots a real virtual machine in your browser, with a real Linux shell. There is nothing to install, and nothing on your own machine to break.

What level is Bash Redirection and File Descriptors?

Labs in this track are rated intermediate.