Several weeks ago, I was at an in-person client meeting where I was getting a walkthrough of how to use a device.
I noticed a book and asked if I could borrow it.
The book:
I consider myself "very experienced" with the Linux command line already, but I wanted to see if I would recommend this book to other people who are just getting started.
I have read 7 chapters (jumping around a bit), and I am very impressed!
My conclusion: I recommend this book without hesitation.
It has good, compelling examples. It is very readable. It is also well organized, so you can focus on whichever topics are most relevant to you. The author did a great job of calling out related Linux system concepts that are pertinent to various commands.
Since 2016, I have been using a bash history tool that saves my bash history forever. (That sounds like an exaggeration but it's really not.)
The original tool:
My "fork" of it:
Since I have kept my bash history since 2016, I realized that I could do an analysis.
I can quantify my own "100 most used bash commands", and then check whether this book teaches about each of them.
The results indeed validate my already strong recommendation of the book.
The "census" of my bash history is also interesting in its own right.
If you do not recognize a command, click the link to learn about it.
Commands are listed from most-used to least-used.
The number after each command shows how many times the command appears in my bash history, between 2016 and 2021.
Four commands are custom, and are explained at the bottom.
- git, 162542
- cd, 43973
- ls, 43133
- grep, 32317
ec
(see bottom section), 15779glof
(see bottom section), 12307- cat, 11352
- rm, 9963
- find, 8569
- sudo, 7907
- cp, 6072
cdg
(see bottom section), 4302- bazel, 3735
- mv, 3687
- echo, 3302
- less, 3269
- eog, 2865
- mkdir, 2844
- diffmerge, 2789
- tree, 2735
- xargs, 2721
- export, 2693
lsfg
(see bottom section), 2490- source, 2306
- touch, 2030
- man, 1592
- make, 1539
- awk, 1538
- ps, 1408
- which, 1268
- sort, 1244
- evince, 1112
- docker, 1048
- file, 1041
- df, 1033
- cut, 1024
- tail, 979
- convert, 936
- pushd, 913
- killall, 846
- pwd, 777
- chmod, 767
- popd, 763
- diff, 750
- ssh, 740
- ping, 703
- head, 690
- du, 636
- gitk, 615
- curl, 608
- wc, 543
- lsof, 509
- On MacOS open, 502
- ln, 487
- vagrant, 470
- ffmpeg, 447
- kill, 419
- qmake, 414
- ifconfig, 410
- qmlscene, 399
- dmesg, 390
- sed, 389
- ldd, 381
- python3, 376
- htop, 346
- strings, 313
- dot, 301
- date, 299
- scp, 287
- umount, 277
- dpkg, 277
- clear, 272
- psql, 268
- unzip, 262
- wmctrl, 239
- jq, 239
- rmdir, 234
- fg, 223
- type, 222
- unset, 220
- cmake, 218
- mount, 214
- tar, 205
- pgrep, 187
- history, 177
- nm, 169
- pkill, 166
- perl, 159
- ipython, 158
- wget, 151
- env, 147
- apt, 145
- nmap, 144
- lsmod, 144
- recordmydesktop, 140
- mediainfo, 132
- gs, 132
- tee, 132
- watch, 126
- gdb, 123
ec
A script as follows. It takes any number of filenames and opens them all in an already-running instance of emacs:
#!/bin/bash
# Should now work on linux AND macos:
# https://stackoverflow.com/a/28806991/10278
echo "$@" | tr ' ' '\0' | tr '\n' '\0' | xargs -0 -n1 emacsclient -n
glof
An alias that shows a compact, columnar, colored git log:
git log --color=always -20 --pretty=format:'%C(yellow)%h|%Cred%cd|%Cblue%an|%Cgreen%d %Creset%s' --date=short | awk '{printf("%s\n",$0)}' | column -ts'|' | less -R -X
cdg
An alias that moves the current working directory to the root of whichever git repository you are navigating in:
cd $(git rev-parse --show-toplevel)
lsfg
A script as follows. It takes grep arguments and does a recursive grep over only version-controlled files in the git repository you are navigating in. In particular, if there are untracked files (such as build artifacts or local config files ignored by git), then those untracked files will not be grepped through:
#!/bin/bash
MYCLRCMD="--color=always"
if [ -t 1 ] ; then
true;
#echo "running in terminal rather than piped to a thing";
else
MYCLRCMD="--color=auto";
fi
# the `find` invocation (for `-type f`) will stop any version-controlled SYMLINK
# files from moving forward in the pipeline
# this tactic excludes submodules
git grep --cached -l '' | xargs -I {} find "{}" -type f | xargs -I {} grep -Hn $MYCLRCMD "$@" "{}"