Interview's MateData Engineer
Interview's Mate

Data Engineer

SQL · Spark · Lakehouse · Streaming

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Data Engineer topics
Lesson 3/ 160
01. Data Engineering Foundations, Python & Linux

Linux Fundamentals & Bash Scripting for Data Engineers

Use the shell confidently: paths, pipes, redirects, text tools, and scripts that glue pipeline steps together.

BeginnerBash · Pipes · Text Tools3 quiz questions
Practice Generative AI Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

pwd, ls, file, head, wc. Next, quote paths and pipe focused tools. Finally, log stdout/stderr, use exit codes, clean traps.

Think of it like…

The pipe is a conveyor belt: if one machine jams, pipefail stops the line instead of letting the final station report that it received zero parcels as success.

Where you’ve seen it

gzip -cd events.jsonl.gz | jq -c 'select(.status == "ok")' | awk -F, 'NF == 9' > valid.jsonl with tee for evidence and pipefail so a failed decompressor aborts the run.

Words you’ll hear

Bash
A shell command language that is useful for orchestration glue and text transformations, not usually for large in-process record logic.
Pipes
A | stream that transfers stdout from one process into stdin of the next while processes run concurrently.
Text Tools
Small Unix programs such as awk, sed, sort, uniq, cut, and grep that compose around line-oriented data.
Operational boundary
A command can print an error and still let the pipeline succeed because a shell reports the last command's status, while unquoted variables split whitespace and globs unpredictably. Use #!/usr/bin/env bash, set -Eeuo pipefail, quote variables, check "$#" arguments, and send diagnostics to stderr while keeping machine-readable output on stdout.

Visual diagram

Loading interactive diagram

Theory & deep dive

Bash: the working mechanism

Bash connects pipeline executables through streams: standard input/output, pipelines, exit statuses, redirection, globbing, and text tools such as awk and sed.

pwd, ls, file, head, wc. Quote paths and pipe focused tools, then set -Eeuo pipefail and explicit checks; this exposes the state governed by Text Tools.

Linux Fundamentals & Bash Scripting for Data Engineers in one concrete design

gzip -cd events.jsonl.gz | jq -c 'select(.status == "ok")' | awk -F, 'NF == 9' > valid.jsonl with tee for evidence and pipefail so a failed decompressor aborts the run.

Key takeaway: Bash connects pipeline executables through streams: standard input/output, pipelines, exit statuses, redirection, globbing, and text tools such as awk and sed

Linux Fundamentals & Bash Scripting for Data Engineers: failure mode and production response

A command can print an error and still let the pipeline succeed because a shell reports the last command's status, while unquoted variables split whitespace and globs unpredictably.

Use #!/usr/bin/env bash, set -Eeuo pipefail, quote variables, check "$#" arguments, and send diagnostics to stderr while keeping machine-readable output on stdout. Track Pipeline status as "0 only when every required command succeeded", and make File descriptor 1 visible to the dataset owner.

Key takeaway: Use #!/usr/bin/env bash, set -Eeuo pipefail, quote variables, check "$#" arguments, and send diagnostics to stderr while keeping machine-readable output on stdout.

How it works, step by step

Step 1 of 4
Bash

1. Inspect

pwd, ls, file, head, wc. Bash connects pipeline executables through streams: standard input/output, pipelines, exit statuses, redirection, globbing, and text tools such as awk and sed.

pwd, ls, file, head, wc
Key numbers at this step
Pipeline status
0 only when every required command succeeded
Pipes
A `|` stream that transfers stdout from one process into stdin of the next while processes run concurrently.

When to use it & trade-offs

What it is

Bash connects pipeline executables through streams: standard input/output, pipelines, exit statuses, redirection, globbing, and text tools such as awk and sed. gzip -cd events.jsonl.gz | jq -c 'select(.status == "ok")' | awk -F, 'NF == 9' > valid.jsonl with tee for evidence and pipefail so a failed decompressor aborts the run.

Why it matters: A command can print an error and still let the pipeline succeed because a shell reports the last command's status, while unquoted variables split whitespace and globs unpredictably. Use #!/usr/bin/env bash, set -Eeuo pipefail, quote variables, check "$#" arguments, and send diagnostics to stderr while keeping machine-readable output on stdout.

When to reach for it

  • Use the shell confidently: paths, pipes, redirects, text tools, and scripts that glue pipeline steps together.
  • Choose Bash because it provides this capability: A shell command language that is useful for orchestration glue and text transformations, not usually for large in-process record logic.
  • Keep evidence for Pipeline status at "0 only when every required command succeeded" so the last production stage-Operate - log stdout/stderr, use exit codes, clean traps-remains testable.

When to avoid or be careful

  • A command can print an error and still let the pipeline succeed because a shell reports the last command's status, while unquoted variables split whitespace and globs unpredictably.
  • Do not conflate Pipes with Bash. The second concept contributes different behavior: A | stream that transfers stdout from one process into stdin of the next while processes run concurrently.
  • Release only after this guardrail is in place: Use #!/usr/bin/env bash, set -Eeuo pipefail, quote variables, check "$#" arguments, and send diagnostics to stderr while keeping machine-readable output on stdout.

Bash / Pipes / Text Tools - roles, limits, and operating cost

Bash
Best for: A shell command language that is useful for orchestration glue and text transformations, not usually for large in-process record logic.

Strengths: A shell command language that is useful for orchestration glue and text transformations, not usually for large in-process record logic. Bash connects pipeline executables through streams: standard input/output, pipelines, exit statuses, redirection, globbing, and text tools such as awk and sed.

Watch out: A command can print an error and still let the pipeline succeed because a shell reports the last command's status, while unquoted variables split whitespace and globs unpredictably.

Pipes
Best for: A | stream that transfers stdout from one process into stdin of the next while processes run concurrently.

Strengths: A | stream that transfers stdout from one process into stdin of the next while processes run concurrently. In this workflow it supports: Guard - set -Eeuo pipefail and explicit checks.

Watch out: The operating cost is real: stdout; reserve it for real result data.

Text Tools
Best for: Small Unix programs such as awk, sed, sort, uniq, cut, and grep that compose around line-oriented data.

Strengths: Small Unix programs such as awk, sed, sort, uniq, cut, and grep that compose around line-oriented data. Its output can be checked with File descriptor 2.

Watch out: Operating guardrail: Use #!/usr/bin/env bash, set -Eeuo pipefail, quote variables, check "$#" arguments, and send diagnostics to stderr while keeping machine-readable output on stdout.

Interview signals & numbers to know

When this topic comes up

  • “Where is the failure boundary for Bash, and how would Pipeline status reveal it?”
  • “Why is Pipes distinct from this behavior: small Unix programs such as awk, sed, sort, uniq, cut, and grep that compose around line-oriented data?”
  • Production clue: A command can print an error and still let the pipeline succeed because a shell reports the last command's status, while unquoted variables split whitespace and globs unpredictably.
  • Design probe: Use #!/usr/bin/env bash, set -Eeuo pipefail, quote variables, check "$#" arguments, and send diagnostics to stderr while keeping machine-readable output on stdout.

Benchmarks & rules of thumb

Pipeline status -
0 only when every required command succeeded
File descriptor 1 -
stdout; reserve it for real result data
File descriptor 2 -
stderr; reserve it for diagnostics and failures

Common mistakes & follow-ups

Common interview mistakes

  • A command can print an error and still let the pipeline succeed because a shell reports the last command's status, while unquoted variables split whitespace and globs unpredictably.
  • Reporting success from a job exit code without checking Pipeline status and File descriptor 1.
  • Treating this example as complete without replay, rollback, or access boundaries: gzip -cd events.jsonl.gz | jq -c 'select(.status == "ok")' | awk -F, 'NF == 9' > valid.jsonl with tee for evidence and pipefail so a failed decompressor aborts the run.

Likely interviewer follow-ups

  • How would you prove this contract instead of only checking that the command ran: A shell command language that is useful for orchestration glue and text transformations, not usually for large in-process record logic.
  • What does the recovery plan do when this occurs? A command can print an error and still let the pipeline succeed because a shell reports the last command's status, while unquoted variables split whitespace and globs unpredictably.
  • When is Bash insufficient for File descriptor 1, and what does adding Pipes cost in Pipeline status?
Interview tip: Lead with the data path and failure boundary: Bash connects pipeline executables through streams: standard input/output, pipelines, exit statuses, redirection, globbing, and text tools such as awk and sed. Then make the answer operational: Use #!/usr/bin/env bash, set -Eeuo pipefail, quote variables, check "$#" arguments, and send diagnostics to stderr while keeping machine-readable output on stdout.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Linux Fundamentals & Bash Scripting for Data Engineers with data engineer interview Q&A and hands-on practice.

Open Data Engineer Q&A →Machine Learning Q&A
Previous topic
Data Lifecycles: Ingestion, Storage, Transformation, Serving & Observability
Next topic
Cron Jobs, File Permissions, SSH & Process Management