- CLI encourages automation (shell commands are easier to repeat/parametrize then GUI steps) - shell instructions are more git friendly than screenshots (even if a process can't/shouldn't be automated. Commands are easier to document in a reusable/updatable way) - CLI can be used to run tests in a way similar how CI does it (more reproducible)
Command line tools are easier to extend/combine with existing pipelines (rg,jq,xargs): read input from stdin/write output to stdout, report on stderr, return non-zero code on error. It enables you to create adhoc tools that you wouldn't bother otherwise (unrelated: LLMs also have this property by making your skill set much broader (though very shallow with current LLMs)). Shell also has Forth-like property (compose with: retry, timeout, setuid, exec, xargs, env, ssh, etc) https://www.oilshell.org/blog/2017/01/13.html
For #1 this blog post has some good examples of quickly chaining together commands (though personally I rarely use xargs) https://drewdevault.com/2020/12/12/Shell-literacy.html
For #2 once you’ve got a command you like, maybe one that generates a metric, you can now re-run it with ease from your history, saved text file, or an alias. You could also share it with teammates.
Please correct me if there are other ways to achieve the above, shell is the only way I know
I mean, surely you already know?
Anything where feeding input between different tasks, or where you want to use regex, or similar things the cl will be superior.
The idea is to be able to use any computer/system/devices easily instead of one perfectly.
Some folks grew up on systems that could fail at any time and leave them with nothing but the tools in /sbin to fix it with. No /usr, no bash/zsh, just sh and vi if you were lucky. You learn to love the cool new things, but you still have a mental bag packed with fsck and ed in case you need to bug out.
It's silly, really because no systems are like that any more, but the things you learned at 2am when you were 22 tend to stick with you.
Same with computers and servers. I interact with a lot of them, but my primary computer that I use >80% of the time is worthwhile to optimize with some tooling that's not available on all the others.
rename s/_small// *_small.jpg
When you have the string ABCD_XYZ in 50 files but you need to change it to DEFG_UVW, how do you do that? perl -pi -e 's{ABCD_XYZ}{DEFG_UVW}' **/*(.)
When you need to move all the files ending '.png' into the directory 'PNG', and all the ones ending '.jpg' into 'JPG', how do you do that? mkdir JPG PNG;
for i in *.png *.jpg; mv $i $i:e:uAnd a shell is a REPL.
A UNIX shell is a very bad approximation of a real programming language REPL.
It is no accident that sh scripts turn into Perl, Python, Tcl, Lisp,... when one wants to keep sanity.
¹ https://zsh.sourceforge.io/Doc/Release/User-Contributions.ht...
² https://zsh.sourceforge.io/Doc/Release/Expansion.html#Filena...
I like the shell but I also think IDEs are underrated.
Pick any X and Y that maximises your ability to feel superior, I suppose.