gitmyhub

bash-guide

★ 12k updated 1y ago

A guide to learn bash

A cheat-sheet reference guide for the Bash shell covering file operations, text manipulation, scripting, and debugging with syntax examples and real output.

BashShellsetup: easycomplexity 1/5

This repository is a practical reference guide for the Bash shell, a command-line interface used on Linux, macOS, and similar operating systems. It is written as a cheat-sheet-style document: each section covers a category of commands, each with a brief description, the syntax, and a working example showing what the output looks like.

The guide is divided into five main areas. The first covers basic operations, grouped into sub-sections for file operations (commands like copying, moving, deleting, and compressing files), text operations (searching and transforming text content), directory operations (creating folders, navigating paths), SSH and networking (connecting to remote machines, checking network status), and process monitoring (seeing what programs are running and managing them).

The second area covers shell programming: writing scripts that do more than run individual commands. This includes storing values in variables, working with lists of items called arrays, manipulating strings, writing reusable functions, making decisions with conditionals (if/then logic), looping over data, using regular expressions to match patterns in text, and connecting commands together using pipes so the output of one command becomes the input of the next.

The remaining sections cover shell tricks (shortcuts and less-obvious features), debugging techniques for finding problems in scripts, and multi-threading (running multiple operations in parallel).

The guide targets beginners and people who use the terminal occasionally and need a quick reminder of how a specific command works, rather than those wanting a deep explanation of internals. The full README is longer than what was shown.

Where it fits