Command-Line Basics
Pipes, Redirection, and Bash Scripting from the Ground Up — A TLDR Primer
The terminal looks intimidating the first time — a blinking cursor, no buttons, no hints. Whether you just enrolled in a CS course, hit a wall trying to run code for class, or need to help a student who suddenly has to know what `cd` and `grep` mean, this guide gets you up to speed fast.
**TLDR: Command-Line Basics** is a focused, short-by-design guide covering everything a high school or early college student needs to feel confident at the prompt. It walks through opening bash on macOS, Linux, and Windows via WSL; navigating the filesystem with `pwd`, `ls`, and `cd`; creating, copying, moving, and deleting files safely (including why `rm -rf` deserves respect); reading files and chaining commands together with pipes and redirection; understanding environment variables and file permissions; and writing a real, working bash script with arguments, conditionals, and a loop.
This is the linux command line basics study guide you keep open next to your terminal — no filler, no bloat. Every concept is explained in plain language, every command is shown with a concrete example, and common beginner mistakes are called out and corrected before you make them.
If you want to learn terminal commands for high school or college coursework without wading through documentation written for sysadmins, this is the book. Open it, open your terminal, and start typing.
- Open a terminal on macOS, Linux, or Windows (WSL) and understand what the shell actually does
- Navigate the filesystem and manage files using cd, ls, mkdir, cp, mv, and rm
- Read, search, and combine text with cat, less, grep, and pipes
- Use redirection, wildcards, and environment variables to control commands
- Write a short bash script with variables, loops, and conditionals
- Recognize and avoid common command-line mistakes that destroy data
- 1. What the Shell Is and How to Open OneExplains what a terminal, shell, and command actually are, and walks through opening bash on macOS, Linux, and Windows via WSL.
- 2. Navigating the FilesystemCovers the directory tree, absolute vs relative paths, and the core navigation commands pwd, ls, cd, and the meaning of ~, ., and ..
- 3. Working with Files: Create, Copy, Move, DeleteCovers mkdir, touch, cp, mv, rm, and rmdir, including the dangers of rm -rf and the lack of an undo.
- 4. Reading Files, Pipes, and RedirectionIntroduces cat, less, head, tail, grep, and how stdin/stdout/stderr connect through pipes (|) and redirection (>, >>, <).
- 5. Variables, Environment, and PermissionsCovers shell variables, the PATH, environment variables, and the basics of file permissions with chmod.
- 6. Writing Your First Bash ScriptBuilds a small bash script using shebangs, arguments, conditionals, and a for loop to automate a real task.