gitmyhub

the-art-of-command-line

★ 161k updated 1y ago

Master the command line, in one page

A practical guide to mastering command-line productivity with concrete examples, tips, and shortcuts for Bash, Linux, and Unix systems.

BashLinuxmacOSUnixWindowssetup: easycomplexity 1/5

The Art of Command Line is a single-page guide that collects notes and tips for using a Unix shell on Linux. The README says it is meant for both beginners and experienced users, with the goals of breadth, specificity, and brevity: every tip is meant to be essential in some situation or to save real time over alternatives. The text exists in English and has community translations into 18 other languages, including Czech, German, Greek, Spanish, French, Indonesian, Italian, Japanese, Korean, Polish, Portuguese, Romanian, Russian, Slovenian, Ukrainian, simplified Chinese, and traditional Chinese.

The guide is organized into a fixed list of sections: Meta, Basics, Everyday use, Processing files and data, System debugging, One-liners, Obscure but useful, macOS only, Windows only, More resources, and Disclaimer. The Meta section spells out the scope. The guide is written for interactive Bash on Linux, includes both standard Unix commands and tools that need extra package installs, and assumes the reader will use a package manager such as apt, yum, dnf, pacman, pip, or brew to install anything that is not built in.

The Basics section is a working sample of the style. It points readers at man bash, recommends learning at least one text-based editor well, names nano, Vim, and Emacs as options, and walks through finding documentation through man, apropos, help, type, and curl cheat.sh/command. It covers redirection with greater-than and less-than signs, pipes, the difference between overwrite and append, file globs, single versus double quotes, Bash job control with ampersand, ctrl-z, ctrl-c, jobs, fg, bg, and kill, ssh and ssh-agent, file management with ls, less, head, tail, ln, chown, chmod, du, df, mount, fdisk, mkfs, lsblk, basic networking with ip, ifconfig, dig, traceroute, route, version control with git, regular expressions and grep flags, and package installation.

The Everyday use section then moves into interactive shell tricks: Tab completion, ctrl-r history search, ctrl-w and ctrl-u line editing, alt-b and alt-f for word movement, ctrl-a and ctrl-e for line ends, ctrl-k, ctrl-l, alt-dot for previous arguments, set -o vi for vi key bindings, and ctrl-x ctrl-e to open the current command in the configured editor. The author notes the page started life as Quora answers, was moved to GitHub, and has been improved by many contributors and translators since.

Where it fits