by Zhyl · 5y ago · 0 comments
If you need to do something ten times, use hotkeys and shortcuts.
If you need to do something a hundred times, write a script (R).
I usually use the command line as the example for why writing code and scripts are better than the more intuitive and lower-learning-curve GUIs.
If I want to move a file from one folder to another then I just drag it across. Easy.
If I want to move a thousand files from one folder to another, I will benefit from learning `CTRL-A` or shift-clicking (slightly more obscure than the 'intuitive' drag each file across individually or drag a large box around them all to select them).
If I want to move a thousand files beginning with 'UTR-77' and ending with '.csv' then I would benefit from learning `mv UTR-77*.csv $folder`, but I could still do it manually if I didn't know that was an option.
If I want to move a thousand files beginning with 'URT-77' to another folder at a moment's notice or at Thursday 1am, then the only options I really have are scripting.
I almost feel like before people learn the 'basic' stuff as outlined at the beginning of the article, they should be shown some 'magic' that is only really possible with scripting so that it's clear from the outset why you wouldn't 'just use excel'.
(And then it saves time anyway, because it turns out I had to do the thing 20 more times after all.)
if you're doing something once and once only, maybe it's a candidate for the manual or gui way.
if you think you might do it twice, it's almost certainly time to automate or start programming it.
Anything encountered in business that you encounter more than 1 time is likely to be encountered N times more.
Other than that, I usually document some ops/quick read me about how to use or prepare the project
1. Use a file manager with stable sorting [1] (I use Thunar which does this, but I suspect lots of file managers keep the sort order stable).
2. Sort by type.
3. Sort by name.
4. Select the first file named UTR-77.
5. Scroll to the last file, and Shift+Click it.
6. Cut then paste to your desired directory.
[1] - https://en.wikipedia.org/wiki/Sorting_algorithm#Stability
But the parent comment was responding to a portion of its parent that specifically said "there's no option other than scripting". It sounds like he's responding to that, not making some general claim about the GUI being a better option.
With thousands of files, this won't be particularly fast or easy.
Another way is to hold down the Ctrl key and use the PgDn/PgUp keys to scroll. If you hold down Ctrl+PgDn you can whip through thousands of files quickly. Because you have the Ctrl key down, it won't affect your selection of the first file.
If all you know is two finger touchpad scrolling, then it will be very tedious.
Unfortunately, from observing a number of people - and apps that hide the scrollbars - it seems to me that two finger scrolling has largely taken over from scrollbar scrolling or the scroll keys.
- Remotely accessing a system (terminal or GUI). - An overloaded system (GUI response is ... inconsisstent) - Remotely accessing a system from a touch-based device. An increasingly common scenario. - Walking someone through a process (text is unambiguous). - Repeated operations (something that has to be done multiple times, in multiple directories, on an ongoing basis, on a scheduled basis, reliably, consistently, provably, with documentation and debuggability).
Additionally, the scrollbar seems to be increasingly unpopular. I'm on record as not being happy about this.
https://ello.co/dredmorbius/post/0hgfswmoti3fi5zgftjecq (HN discussion: https://news.ycombinator.com/item?id=21356511)
In far manager (freeware, open source) and total commander (commercial, not too expensive, trial available), numpad `+` key open “expand selection” popup, where you can type “utr-77
.csv”, and it will select just these files.Unlike the command line, you can inspect what had been selected before moving these files. You can also use insert/numpad +/numpad - keys to modify the set of files going to be moved/copied/deleted/zipped/etc.
Most file systems and file managers don’t have undo support. It can be important to review what going to happen before actually moving any files.
I have a few of them glancing at me from the corner of my desktop and I hope to do something "over the summer".
Even this is easier with scripting, especially if you're already used to thinking in wildcards and tab-completion. Scrolling, hunting for files, dragging, clicking: these are inherently clumsier and slower steps, optimized for new-user intuitiveness and simplicity over efficiency. The upfront investment of making your brain think in CLI is fairly high, but once you've done it, there's vanishingly little reason to bother with file browsers. I don't think I've used one in a decade, even with (eg) Nautilus's ability to match wildcards with ctrl+s.
For example, How did I do that magical ffmpeg thing last time? Just hit ctrl-r, type ffmpeg, and keep hitting ctrl-r to find previous examples until I find what I'm after.
I’ve got a bunch of saved notes with various incantations that would become redundant if so!
Throw them in scripts! Another advantage of using a CLI is that it provides a friction-free path from ad hoc commands to saved commands to messy scripts to properly supported tools. I've ridden this gradient multiple times prfoesssionaly, especially now that I work with a bunch of PhDs who are less comfortable around OSes than I am. It's a good feeling to have such a clean pipeline from "this command/series of commands feels awkward to me" to a reviewed, checked-in tool that becomes a critical part of the team's workflow. The best part is that there's value at every incremental step, so you don't need to invest any organizational effort, which is especially useful in a chaotic execution environment.
https://stackoverflow.com/questions/41780746/searching-your-...
Good to double check how to turn off the history size limit before throwing away the post it notes entirely.