» Unit 1: Conversing in Plain Text
Bash/sh/zsh family is brilliant at intense interaction with humans. Aliases, short built-in commands, one liner-oriented nature, keyboard ergonomics, really concise file/process handling - all of this makes it the shell.1
1. https://web.archive.org/web/20150623025431/https://news.ycombinator.com/item?id=6866085
The craft of scripting is not hard to master, since scripts can be built in bite-sized sections and there is only a fairly small set of shell-specific operators and options [1] to learn. The syntax is simple—even austere— similar to that of invoking and chaining together utilities at the command line, and there are only a few “rules” governing their use. Most short scripts work right the first time, and debugging even the longer ones is straightforward.2
2. http://www.tldp.org/LDP/abs/html/why-shell.html
One person who posted to the net said he had an “epiphany” from a shell script (which used four commands and a script that looked like line noise) which renamed all his
.pas
files so that they ended with.p
instead. I reserve my religious ecstasy for something more than renaming files. And, indeed, that was my memory of Unix tools—you spend all your time learning to do complex and peculiar things that are, int he end, not really all that impressive.3
3. Gim Giles of the Los Alamos National Laboratory as quoited in Garfinkel, Simson L., Donald Norman, and Dennis Ritchie. The UNIX Hater’s Handbook: The Best of UNIX-Haters On-Line Mailing Reveals Why UNIX Must Die!. Edited by Daniel Weise, Simson Garfinkel, and Steven Strassmann. San Mateo, CA: IDG Books Worldwide, 1994, 161.
Resources
- The Command Line Crash Course by Zed Shaw
- Bash Guide for Beginners by Machtelt Garrels
- Data Science at the Command Line by Jeroen Janssens
- The Bash Guide, Bash Reference Sheet, and the old BashGuide by Maarten Billemont
- The Art of Command Line by jlevy
- commandlinefu.com
- Advanced Bash-Scripting Guide by Mendel Cooper
- Bash Pitfalls
Follow Along
mkdir test/
cd test
echo "hello world" > hello.txt
cat hello.txt
wc -c hello.txt
# open Microsoft Word
# type hello world
# save file to your test folder as hello.docx
cat hello.docx
wc -c hello.docx
# What other information accounts for the disparity between hello.txt and hello.docx?
Historical Interlude: Morse and Baudot
Your Turn
- Find three different types of files online
- Download to your
test/
directory - use
cat
to peak inside