🎁 New User? Get 20% off your first purchase with code NEWUSER20 · ⚡ Instant download · 🔒 Secure checkout Register Now →
Menu

Categories

Loading preview...

Download the Full Cheat Sheet

Enter your email below to get the complete PDF for free

Get Free PDF
Linux Quick Reference (1-2 pages)

Linux Commands: Shell Scripting (Part 2)

Linux command reference for Shell Scripting: printf, read, seq, sleep, source, test, trap, type, wait, yes. Includes syntax, options, practical examples with output, and pro tips. 18 pages, 10 commands.
1 downloads
PDF Format
Free

Download This Cheat Sheet

Enter your email to download the PDF for free.

About This Cheat Sheet

Linux Commands: Shell Scripting (Part 2) is a compact 1-2 page quick reference designed to live next to your keyboard or pinned to your monitor. It is intentionally dense — every line is a command, flag, or pattern you will actually reach for.

Linux Commands: Shell Scripting (Part 2) covers Bash — the default shell on most Linux distributions and macOS, and the universal scripting language of automation, CI/CD, and operations. It is written for sysadmins, DevOps engineers, SREs, developers writing build/deploy scripts, and anyone living in a terminal who need accurate, working syntax without wading through documentation. This particular sheet zooms in on Commands shell scripting, Part — the parts of Bash that come up most often in real work. Linux command reference for Shell Scripting: printf, read, seq, sleep, source, test, trap, type, wait, yes. Includes syntax, options, practical examples with output, and pro tips. 18 pages, 10 commands.

Every command, flag, and pattern in this sheet has been validated against current stable releases as of 2026. Where syntax differs between distributions, versions, or platforms, both forms are shown so you can copy-paste safely regardless of the environment you are working in. The PDF is print-ready in both A4 and US Letter formats and remains free to download forever.

What's Inside the PDF

  • Commands Shell Scripting — the practical commands and patterns you actually use in production Bash work.
  • Part — the practical commands and patterns you actually use in production Bash work.
  • Most-used commands grouped by task, not alphabetically, so you find what you need by intent.
  • Common flag combinations with one-line comments explaining what each option actually does.
  • Real-world examples that show inputs and expected outputs, not contrived hello-world snippets.
  • Edge cases and gotchas that the official documentation buries on page 47.
  • Print-friendly layout that works equally well on screen and on paper next to your monitor.

When to Use This Cheat Sheet

  • 1Writing automation scripts that wrap CLI tools, parse output, and handle errors gracefully.
  • 2Composing one-liners with pipes, `awk`, `sed`, `grep`, `xargs`, and `jq` to wrangle text and JSON.
  • 3Building CI/CD pipeline steps that need to be portable across Linux runners.
  • 4Operating in restrictive environments where Python is not installed and Bash is the only available tool.
  • 5Reviewing and debugging legacy shell scripts with arcane syntax.

Key Concepts to Master

Word splitting

Unquoted variable expansions are split on whitespace. Always quote: `"$var"` not `$var`. This single rule prevents 80% of shell bugs.

Exit codes

Every command returns 0 (success) or non-zero (failure). Check `$?` or use `&&`/`||` to chain conditionally.

Subshells and process substitution

`(cmd)` runs in a subshell with isolated variables. `<(cmd)` provides a file-like input. Both are essential for clean composition.

Parameter expansion

`${var:-default}`, `${var/pattern/replacement}`, `${var##prefix}`, `${var%%suffix}` — the manual is dense but worth a careful read.

Set options

`set -euo pipefail` at the top of every script stops on errors, undefined variables, and pipeline failures. This is non-negotiable for production scripts.

Pro Tips from Practitioners

  • Lint every script with ShellCheck. It catches quoting bugs, missing variables, and bad practices instantly.
  • Prefer `[[ ]]` over `[ ]` for conditionals — it is safer and supports regex matching.
  • Use `printf` instead of `echo` for portability and control over formatting.
  • When a script grows beyond 200 lines, rewrite it in Python or Go. Bash is for orchestration, not application logic.
  • Always quote variable expansions: `cp "$src" "$dst"` not `cp $src $dst`. Spaces in filenames are real.

Interactive Linux Commands Reference

Explore 232+ commands with syntax, examples, options, and pro tips.

Browse Commands

Frequently Asked Questions

What is the Linux Commands: Shell Scripting (Part 2)?

The Linux Commands: Shell Scripting (Part 2) is a free, professionally designed PDF reference covering Bash. It is curated by practitioners and validated against current stable releases as of 2026.

Is this enough to learn Bash from scratch?

No — this is a quick reference for people who already know the basics. If you are new to Bash, start with our Beginner's Complete Guide in the same series, then return here for daily lookups.

Why does my script work in Bash but not in sh?

Bash adds extensions on top of POSIX `sh` — arrays, `[[ ]]`, process substitution, brace expansion. If you must support `sh`, set the shebang to `#!/bin/sh` and run ShellCheck with `-s sh`.

How do I parse JSON in Bash?

Use `jq`. It is purpose-built for JSON, ships with most distributions, and combines naturally with pipes: `curl -s api/x | jq -r .field`.

Is Bash still relevant in 2026?

Yes. Despite the rise of Python and Go for serious automation, every Linux server, container, and CI runner has Bash. It is the universal glue.

What is the safest shebang to use?

`#!/usr/bin/env bash` is the most portable — it picks up Bash from `PATH` regardless of where it is installed (handy on macOS where `/bin/bash` is ancient).

Is this cheat sheet really free?

Yes, completely free. We ask for your email so we can let you know when new cheat sheets are released and to keep our spam-detection systems happy. You can unsubscribe in one click at any time.

Can I print and share this cheat sheet?

Yes — print it, pin it to your wall, share it with your team, hand it out at meetups. The only thing we ask is that you do not strip the Dargslan attribution or republish the PDF as your own work.