shell-101.org (1112B)
1 My tentative introductory guide to navigating a shell interface 2 (assuming Bash). 3 4 🚧 These are rough notes meant for guiding in-person discussions; they 5 are somewhat terse. 🚧 6 7 * Moving around, invoking stuff 8 9 With a file browser and a terminal emulator side-by-side: 10 11 - ls, cd, mkdir, touch, rm; "/" = root 12 - globs 13 - arguments vs options (e.g. ls, diff) 14 - man, --help 15 - standard input/output/error: pipes, redirection 16 - writing scripts (shebangs: see bash(1) § COMMAND EXECUTION) 17 18 * Shell language 19 20 - ; & (e.g. sleep) 21 - && || (e.g. grep) 22 - if, for 23 - $? (e.g. grep, diff) 24 - [ 25 - variables 26 - functions, $@, $1… 27 - black-box model of a command: 28 - inputs: stdin, arguments, environment 29 - outputs: stdout, stderr, exit code 30 - side-effects: I/O, e.g. files, network 31 - which, type: keyword ≠builtin ≠function ≠program 32 - valar quotulis (valar escaepis); e.g. sort operator: [ foo '>' bar ] 33 34 * Advanced 35 36 - ( ) ≠{ }: try to set variables, or call exit 37 - (( )), $( ) 38 - glob ≠regex 39 - bash extensions 40 - [[ 41 - <( ) 42 - |&, >& 43 - arrays 44 - job control: fg, bg, jobs, wait, kill, C-z