slowly working on a mega terminal cheat sheet
here's a link to the draft as a PDF: https://jvns.ca/terminal-cheat-sheet-draft.pdf
slowly working on a mega terminal cheat sheet
here's a link to the draft as a PDF: https://jvns.ca/terminal-cheat-sheet-draft.pdf
@weaselx86 In Bash you have to enable **/ with `shopt - extglob`.
@b0rk **/ is useful enough and Bash common enough that IMO it'd be worth adding the above to the sheet.
I tried **/*.txt and got the same result as my usual */*.txt. Using bash, but I've always used */*.txt with previous shells such as sh and csh.
@b0rk **/ is new to me
@b0rk Because (1) Bash caches PATH lookups by default and sometimes that causes confusing discrepancies with `which`, and (2) `which` isn't always installed, I encourage folks to basically always use `type` instead of `which`.
Also, I use a lot:
! xyz repeats the command number xyz in the history list.
!pattern repeats the last command in the history list that matches the pattern .
Example, given this history
505 dmesg
506 history
507 top
508 tail *OUT
509 history
!505 -> repeats dmesg
!to -> repeats top
!ta -> repeats tail
extglob seems to be on by default on my system (Ubuntu 20.04.6 LTS).
I still don't understand what the difference is supposed to be between
*/*.txt and **/*.txt
Here are my "glob" shopt settings:
dotglob off
extglob on
failglob off
globstar off
nocaseglob off
nullglob off
** searches down _multiple_ directory levels recursively. So while they'd both find things 1 layer down like foo/bar.txt, **/*.txt will find foo/bar/baz.txt while */*.txt won't.
GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.
All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.