4 ms·
If you want to master the shell (it will save years of your life), follow these guides. I highly recommend reading the entire BASH manual, it will answer every
by 0xbadcafebee 8mo ago
If you want to master the shell (it will save years of your life), follow these guides. I highly recommend reading the entire BASH manual, it will answer every question you'll ever have, or at least give you a hint about it, as well as expose you to all the hidden knowledge (some call it "gotchas") you'll wish you knew later.
101
- Bash for Beginners (https://tldp.org/LDP/Bash-Beginners-Guide/html/)
- Bash Tutorial (https://www.w3schools.com/bash/)
201
- Bash Programming (https://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html)
- Advanced Bash Scripting Guide (https://tldp.org/LDP/abs/html/)
301
- The Bash Manual (https://www.gnu.org/software/bash/manual/bash.html) (https://man7.org/linux/man-pages/man1/bash.1.html)
- ShellCheck (https://www.shellcheck.net/)
To find every Unix-y program and get a 1-line description of it (and referenced programs/functions), run:
for i in $(ls /bin/* /usr/bin/* /sbin/* /usr/sbin/* | sed -E 's?.*/??g' | sort -u) ; do
echo "command: $i"
whatis "$(basename "$i")" | cat
echo ""
done | tee command-descriptions.log
View 'command-descriptions.log' with less command-descriptions.log, use arrow-keys and page up/down to navigate, and type 'q' to exit. To find out more about a program like df(1), run man 1 df.
- e12e 8mo agoI think looking at some of the documentation for oils (née oil sh) and ysh - as well as [looking at using] these two projects [in place of bash] - is also a good idea today: https://oils.pub/ https://oils.pub/
- zahlman 8mo agoI think I would do it more like: find /bin/ /usr/bin/ /sbin/ /usr/sbin/ -executable -type f -exec whatis "$(basename {})" \; | sort -u > commands.txt
- 0xbadcafebee 8mo agoYou would need to make those double-quotes into single-quotes. Double-quotes will interpolate the $() immediately, running basename before find runs. Single-quotes will not interpolate the $(), so the whole string gets passed to find for it to execute each time
- zahlman 8mo agoIt worked when I tried it. Upon investigation, this is because `basename {}` returns `{}`, which is interpolated; thus the exec just uses the full file paths; but as it turns out, `whatis` works fine with those paths. It won't work with single quotes because `find` won't do that interpolation when it processes the `-exec` arguments; `whatis` ends up receiving a string with a literal dollar sign etc. I think the kind of interpolation I originally had in mind isn't possible with `find`. Thankfully it apparently isn't needed (at least with my local `whatis`).