Brushing up on zsh and Oh My Zsh

Since macOS has now moved from bash to zsh, it seems like a fine time to revisit the basics of my preferred shell.

I use the command line daily and it's an indispensable part of how I get things done on my Mac and remote machines. However, it's probably also an area I don't explore as much as I should. I'm fairly set in my ways on the command line.

I've been using zsh, powered up by Oh My Zsh, as my shell for years now. Certain conveniences this combination provides (like being able omit cd when navigating with .. [aka, "autocd"], or being able to use the tab and arrow keys to autocomplete and select directory contents) are deeply engrained in how I use the command line.

Since macOS has now moved from bash to zsh, it seems like a fine time to revisit the basics of my preferred shell.

I did a quick runthrough of Wes Bos's Command Line Power User course and ended up picking up a few things I hadn't learned about zsh before:

  1. take <dirname> is convenient shorthand for mkdir <dirname> && cd <dirname>
  2. ... will move you up two directory levels
  3. "<cmd> - + tab" will list the valid flags you can pass to the command (e.g., ls - + tab)
  4. Oh My Zsh's z plugin uses your directory navigation history to give you quick access to "frecent" (frequent + recent) locations on your machine

Also, while not specifically a zsh/Oh My Zsh tip, Wes also recommended using the Node.js trash-cli module instead of rm for deleting files and directories. The trash command moves your deleted items to the OS trash can, rather immediately obliterating them from existence, the way rm does. I thought this was a great tip, and something I'd like to start remapping my brain to doing.

A couple of other zsh resources on my list for another time: