iTerm2 "snippets"

On the last show (Ep. 665), one piece of listener feedback suggested saving Terminal commands as TextExpander snippets. I have a few of those myself—e.g., rsynccc expands to rsync -ahmz --info=progress2 --partial. However, for infrequently-used commands, I found myself unable to remember the TextExpander shortcut!

This is where iTerm2’s “Snippets” feature comes in handy. It provides a sidebar where you can store such commands and also give them plain-English names. Here’s mine:

screenshot_5531

4 Likes

I use zsh aliases for this type of thing. Most other shells support this as well. Read more here: A User's Guide to the Z-Shell

1 Like

The nice thing about having those snippets on the terminal itself is that they will work in the particular case when you jump through several hosts which you do not really have control over, this is really common in corporate IT environments.

3 Likes

pantulis gets it. I also like the “plain language” explanation in the Snippets sidebar, rather than me having to remember an alias for things I rarely use.

Typing the alias command will show you a list of all your aliases.