SOLID STATE PRESS
← Back to catalog
Command-Line Basics cover
Coming soon
Coming soon to Amazon
This title is in our publishing queue.
Browse available titles
Computer Science

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.

What you'll learn
  • 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
What's inside
  1. 1. What the Shell Is and How to Open One
    Explains what a terminal, shell, and command actually are, and walks through opening bash on macOS, Linux, and Windows via WSL.
  2. 2. Navigating the Filesystem
    Covers the directory tree, absolute vs relative paths, and the core navigation commands pwd, ls, cd, and the meaning of ~, ., and ..
  3. 3. Working with Files: Create, Copy, Move, Delete
    Covers mkdir, touch, cp, mv, rm, and rmdir, including the dangers of rm -rf and the lack of an undo.
  4. 4. Reading Files, Pipes, and Redirection
    Introduces cat, less, head, tail, grep, and how stdin/stdout/stderr connect through pipes (|) and redirection (>, >>, <).
  5. 5. Variables, Environment, and Permissions
    Covers shell variables, the PATH, environment variables, and the basics of file permissions with chmod.
  6. 6. Writing Your First Bash Script
    Builds a small bash script using shebangs, arguments, conditionals, and a for loop to automate a real task.
Published by Solid State Press
Command-Line Basics cover
TLDR STUDY GUIDES

Command-Line Basics

Pipes, Redirection, and Bash Scripting from the Ground Up — A TLDR Primer
Solid State Press

Contents

  1. 1 What the Shell Is and How to Open One
  2. 2 Navigating the Filesystem
  3. 3 Working with Files: Create, Copy, Move, Delete
  4. 4 Reading Files, Pipes, and Redirection
  5. 5 Variables, Environment, and Permissions
  6. 6 Writing Your First Bash Script
Chapter 1

What the Shell Is and How to Open One

When you type a command and press Enter, something has to receive that text, interpret it, and make the operating system act on it. That something is the shell — a program that reads your input, figures out what you mean, and tells the OS to do it. The shell is the engine. The terminal (also called a terminal emulator) is the window you type in — it's just the interface, the way a web browser is an interface to the internet. A common mistake is to treat these two words as synonyms. They are not: you open a terminal, and inside that terminal a shell is running.

The specific shell this book uses is bash (short for Bourne Again SHell). Bash is the default on most Linux systems, was the default on macOS until 2019, and is what you get inside Windows Subsystem for Linux. Other shells — zsh, fish, sh — share most of the same ideas, but bash is what you will encounter first in classes, tutorials, and server environments, so it is the right place to start.

When bash is ready for your input, it displays a prompt — a short line of text ending in $. The prompt often shows your username, the machine name, and the current folder, like this:

alex@laptop:~$

Everything before the

When you type a command and press Enter, something has to receive that text, interpret it, and make the operating system act on it. That something is the shell — a program that reads your input, figures out what you mean, and tells the OS to do it. The shell is the engine. The terminal (also called a terminal emulator) is the window you type in — it's just the interface, the way a web browser is an interface to the internet. A common mistake is to treat these two words as synonyms. They are not: you open a terminal, and inside that terminal a shell is running.

The specific shell this book uses is bash (short for Bourne Again SHell). Bash is the default on most Linux systems, was the default on macOS until 2019, and is what you get inside Windows Subsystem for Linux. Other shells — zsh, fish, sh — share most of the same ideas, but bash is what you will encounter first in classes, tutorials, and server environments, so it is the right place to start.

When bash is ready for your input, it displays a prompt — a short line of text ending in $. The prompt often shows your username, the machine name, and the current folder, like this:

alex@laptop:~$

Everything before the is information bash is giving you. The `$ itself marks where you start typing. A command is what you type after the prompt: a word (or words) that tells bash to do something. When you press Enter, bash reads the command, executes it, and — once it finishes — shows you a new prompt to signal it is ready again.

How to Open a Terminal

On Linux, the method depends on your desktop environment, but the universal shortcut is to right-click the desktop and look for "Open Terminal," or search your applications menu for "Terminal," "Konsole," or "GNOME Terminal." Once it opens, bash is almost certainly the shell already running inside it.

About This Book

If you are a high school or early college student who keeps hearing that you should "learn terminal commands" but have no idea where to start, this book is for you. Maybe your CS teacher mentioned the command line in passing, your intro programming course assumes you already know it, or you just want to stop feeling lost every time someone says "run this in your shell."

This is a Linux command line basics study guide that also covers macOS and Windows users running WSL — so it works as both a how to use the command line on Mac or Linux reference and a WSL Bash tutorial for Windows beginners. Topics include file navigation and shell scripting, pipes, redirection, environment variables, file permissions, and writing your first real Bash script. A concise overview with no filler.

Read it straight through, work every example as you go, then try the problem set at the end. One focused session is enough to get oriented.

Keep reading

You've read the first half of Chapter 1. The complete book covers 6 chapters in roughly fifteen pages — readable in one sitting.

Coming soon to Amazon