CLI (4 blogmarks)

← Blogmarks

Shell Tricks That Actually Make Life Easier (And Save Your Sanity)

https://blog.hofstede.it/shell-tricks-that-actually-make-life-easier-and-save-your-sanity/

The shell is a toolbox, not an obstacle course. You don’t need to memorize all of these today. Pick just one trick, force it into your daily habits for a week, and then pick another. Stop letting the terminal push you around, and start rearranging the furniture. It’s your house now.

This post is jam packed with useful stuff it took me years to pick up. Plenty of new-to-me things that I’m looking forward to integrating into my workflows.

I've been thinking about what things I would add if I were writing my own version of this article:

  •  <command> -- include a space in front of a command to exclude it from shell history
  • fc -- edit the last command
  • command <some alias> -- ignore the alias (e.g. I have cat aliased to bat, but maybe I actually want to run cat)

Assorted less(1) tips

https://blog.thechases.com/posts/assorted-less-tips/

I love an article like this where a person demonstrates a bunch of niche features of a tool they are a power-user of. In this case less.

I didn’t know there was much more to do with less than pipe it a bunch of stdout or view a log file with it.

A couple features that stood out to me where:

  • using -N and -n to toggle line numbers on and off
  • doing successive filtering with multiple % pattern invocations
  • pulling in and navigating multiple files (still not totally sure of the workflow I’d use this for)

Git - Plumbing and Porcelain

https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain

I like this concept of Plumbing versus Porcelain CLI commands. I recently referenced it in Connect To Production Rails Console on AWS / Flightcontrol - Notes from VisualMode.

because Git was initially a toolkit for a version control system rather than a full user-friendly VCS, it has a number of subcommands that do low-level work and were designed to be chained together UNIX-style or called from scripts. These commands are generally referred to as Git’s “plumbing” commands, while the more user-friendly commands are called “porcelain” commands.

Build complex CLIs with type safety and no dependencies

https://bloomberg.github.io/stricli/

I heard about this from Matt Pocock who says he is moving a tool he is building from Commander to StriCli.