A quick little terminal tip

Mon 30 January 2023

Becoming a terminal file management enjoyer

I was pretty under the weather today, so I wasn't able to compose a longer post, but I felt I should post something, so here we are 🙂

I've used a lot of various operating systems and interfaces, from BASIC-oriented 8-bit systems to Classic Macs, OS/2, Windows 3.1 through 7, and of course “Classic” X11 on SunOS in the early nineties, the criminally under-rated OpenWindows desktop for Sun machines, early Linux desktops like FVWM95, Gnome 1, 2, 3+, and KDE Plasma 1, 2, and 5.

While I'll always have an appreciation for an efficient, aesthetic desktop, and I'd have a hard time ever replacing good old-fashioned LibreOffice Calc for hammering out some spreadsheets, the Command Line is where the real work gets done.

Cut to the chase

The most recent area of my work where I've converted from GUI tools to purely command line is file management. Of course, I'd often drop into a terminal to do things like find and other batch file management tasks, but there was something very comfortable and familiar with the graphical file manager. PCmanFM was my file manager of choice, as it was very light, performant, and fully-featured. But not wanting to forsake any potential “nerd cred,” I decided to give terminal file managers a try. I liked Ranger's feature set, but I wasn't as fond of a columnar layout as others are, so I decided to keep looking. I recalled one youtuber talking about nnn as an alternative, and I found it to be very fast and lightweight, if a bit inflexible in its goals (not sure why “no config file” is such a good idea, but hey, it's not my project). The bookmarks shortcut quickly became my favorite feature, as it let me traverse many verbose directory structures instantaneously, without having to clumsily select one directory at a time. Even with something like tab completion, it would have been very tedious, as the directories are within a cloud account which is shared, and I cannot simply flatten the structure and rename the directories just to suit my own preferences.

After using nnn for a while, I decided (partially on a dare from some fediverse friends) to try going straight command-line, cold-turkey. After some digging, I found the command that would allow me to mount and unmount disks using the same mechanism as the GUI tools (udisksctl) and created a simple shell function to make mounting and ejecting USB disks quite simple. With that impediment out of the way, there was no reason not to quit GUI file managers altogether.

But... I found that I missed nnn's bookmarks. Typing out commands like cd Google Drive/Company Files/Financials/2022/Accounts Receivable/ was incredibly tedious, even with tab completion. I then recalled that nnn's bookmarks were nothing more than a directory full of symlinks within ~/.config/nnn, and there was nothing preventing me from making my own.

So, I simply created a ~/.bookmarks directory and populated it with symlinks that were very easy to type: short, no spaces, no capitalization, and each starting with a different letter of the alphabet, such as:

acctsrec -> ~/Google Drive/.../.../Accounts Receivable/2022/
taxdocs -> ~/Google Drive/Financials/Tax Documents/2022/

(etc.)

100DaysToOffload – Day 3

Category: Tech Tagged: 100DaysToOffload Computing Linux/Unix Tips Non-religious post