How to be cutting-edge and old-school in the Linux terminal

Linux facilitates heavy automation or optimization of frequently recurring tasks. For the most part, I employ terminal-based, also known as command-line interface (CLI) applications for this purpose. They offer numerous benefits:

A CLI workflow also offers the inherent benefit in the mechanics of largely maintaining your hands on the alpha-numerical portion of the keyboard, without the chaotic shifts to the mouse or the more distant ancillary keys. You can achieve significant leaps in productivity and speed in becoming accustomed to CLIs.

I also prefer CLI applications for the retroactive sensation they evoke. Rather than emphasizing visual appeal, development effort yields most focus to pure utility.

Here I survey the different categories of CLI applications I rely on in my present configuration.

Terminal-based File Managers

You can accomplish much via raw terminal commands for many file and directory navigation and manipulation tasks. In some cases, however, the interaction can become a nuisance for heavily repetitive operations not easily automated via a terminal. In such cases, I have used two among many terminal-based file managers: Midnight Commander and Ranger.

I have used Midnight Commander as early as 1995 on a DOS system, then titled Norton Commander. The traditional blue background and shortcut keys always felt familiar and yet lend to much customization.

Lately, however, I transitioned to Ranger, offering far more power and flexibility than MC, and configured for VIM-like navigation and shortcut keys by default. I would call Ranger a meta file manager even, since you can redefine much of the underlying behavior and interaction mechanism to your liking. I have optimized many of my most frequent operations, such as navigating to frequently used files and directories, remotely manipulating music listening, and copy/move/rename operations in a way far more efficient than traditionally provided by the raw terminal, MC, or especially a graphical file manager. You would have to experiment with it yourself to uncover the potential.

Session-based terminal managers

TMux and Screen are both terminal multiplexors and session managers, allowing you to split and manage your terminal session across windows and panes, search through the terminal buffer, but most importantly, maintain entire terminal sessions in memory. As such, you are free to disconnect and reconnect to a session, saving your entire terminal layout and workflow in the process. Both session-managers are heavily configurable and shortcut-oriented. I operate almost exclusively in the confines of a Tmux session.

VIM and Emacs powerful text editing

I use VIM almost exclusively for all text-editing operations. Emacs is an alternative all-in-one text editing (and more) ecosystem, although somewhat heavier than VIM, but I cannot comment on much more. Each requires a moderate learning curve, months perhaps, to get accustomed to even a small portion of functionality, which, however, in accordance with 80/20, will represent mostly everything of need.

The functionality I extract from VIM involves the following:

Console-based music players

Cmus is a console music player, while mpd is more of a daemon requiring a client, but both provide essentially console-based music playing. I use the former.

Both can be configured to navigate across your multimedia library with ease of quick shortcuts, manipulate playback, and interface with other applications. I configured ranger, for example, to interact with cmus via 2-keystroke combinations, as well as add groups of selected multimedia files to the immediate playlist.

Text-based document creation

These tools, and others, abstracted the task of document composition from the interaction with word processors and IDEs.

Latex is a document typesetting system that, via combinations of internal and external modules can render any sort of PDF document by means of pure text manipulation. This can involve mathematical symbology, complex diagrams, plots, tables, and effectively whatever you have ever seen in a PDF document, no exception beknown to me. Most academic publications with scientific basis are actually composed via Latex, although you could easily use it for something entirely informal as a simple letter or a journal.

Similar to the VIM text editor, the Latex ecosystem can require months to adapt, but then yield a lifetime of dividends.

Pandoc is a system to convert between different markups or to compile a markup into a PDF (via Latex as an intermediary) or other visual formats. I have already written a post on quick generation of slides via markup in Pandoc.

Asymptote, albeit less frequently used by me, is one of a number of alternatives to render vector-based graphics by means of pure programming, for those more inclined towards mathematics and less towards visual tools. It also interfaces naturally with Latex.

The beauty of working with text-based formats lies in the power to wield other text-manipulation tools or mechanisms to generate or transform any syntax into any other. For example, you are free to generate your own abstractions to transform simpler directives into those more complex, such as a complex vector-graphics based routine from a very simple parameterized directive. Ultimately, this relates to modularity.

Terminal-based email

I admit to having interchanged much between CLI email tools and web-based interfaces to the likes of Gmail. I had initially used alpine for many years, but recently became interested in neomutt, a mutt variant, if for no other reason that for familiarity with VIM-like key bindings.

As a slight detour, I must emphasize that VIM and Emacs represent such an integral asset to the Linux ecosystem that their signature keybindings have become adapted by a series of other CLI-based tools requiring any sort of navigation or searching among contained elements.

I’m not yet convinced that a terminal-based email client can lead to a strictly-speaking quicker workflow than a web-based interface such as Gmail, which as a matter of fact also features configurable key-bindings, albeit less known. I am, however, convinced that with enough practice, it will certainly not compromise the workflow - a win, considering yet another operation divorced from the realm of graphical utilities for lighter-weight and modular CLI tools.

Cloud computing

Google, Amazon, and Dropbox (among others) provide CLI tools for many of their principle products.

I frequently leverage the Amazon AWS CLI tools to 1) interact with the Amazon S3 storage cloud, and 2) manage the Amazon EC2 computing instances. The extent to which these can streamline your workflow is limited mostly to imagination.

Console web browsers

I use console-based web browsers sporadically, mostly out of occasional curiosity to the extent of how much web content I can outsource to the more limited-capacity text-based web browser engines. Despite years of such experiments with all the mentioned browsers here, I haven’t maintained enough consistence and refrain from further generalization. In fact, I wish to postpone such analysis for a different post, as I believe much intriguing utility can be extracted from proper application of these controversial tools.

Other powerful CLI tools

Sources referenced

  1. Midnight Commander
  2. Ranger
  3. TMux
  4. Screen
  5. VIM
  6. Emacs
  7. cmus
  8. mpd
  9. Latex
  10. Pandoc
  11. Asymptote
  12. quick generation of slides
  13. alpine
  14. neomutt
  15. Amazon AWS CLI
  16. w3m
  17. lynx
  18. links
  19. jrnl