Here are 5 Killer Features of the iTerm2 Terminal Emulator

The iTerm 2 terminal emulator is one of the most crucial applications in my toolbelt, as I live on the command line. Other than my text editor, this is where I spend the most time in my development workflow.

Until recently, I never reflected on how important it is to my development workflow. Nearly 10 years ago, one of my first programming mentors told me to use it, and I blindly followed that advice. I’ve been recommending it to people for almost as long, without really understanding why.

Below, I’ll talk about killer features I can’t live without in a terminal emulator and why iTerm2 is the best choice for you.

But first, let me quickly describe the constraints for a project I’m currently working on, so I can refer to this as I’m describing my iTerm setup.

I’m working across four repositories, multiple separate frontends, multiple backends, and various other runners. It can be hard to keep track of all of this, so I tend to rely on my tools to do it for me. This is a complicated setup, but it’s emulating a micro-service architecture, both on the frontend and backend, and some mock AWS services running locally. Many of the features of iTerm are improved exponentially with a complicated setup like this, but it’s still powerful even if your needs aren’t as complicated.

Profiles

Profiles are a great solution for customizing your setup without changing global settings. With the shell integration installed, you can even turn on automatic profile switching when your hostname, username, or directory changes. In my case, I have separate profiles for certain working directories.

All the Colors! (Tabs, Background)

We can engage our visual cortex to help quickly determine where we are in a work tree. For example, I have different profiles set up for various directories. Each profile for different repository + directory combination is set to a slightly different color, so I can quickly tell if I am where I need to be. When I look at a terminal window, I know immediately where I am. You can even set custom background images for terminal windows.

You can even color your tabs by right-clicking and selecting a color. This is a great way to quickly get some additional context about where you’re located.

Dead Simple Split Panes

I rely on multiple terminals running different commands because I don’t want to conflate front-end build output with back-end logs. Currently, I’ll run six separate processes at minimum and will track the output for each. Occasionally I’ll need more. For most of the common tasks, I cram them all into a single tab with multiple panes because I don’t want to think about them very often. If I do want to see the output, I can press ⌘ + ⇧ + ⏎, and it will temporarily expand the pane.

Most of my profiles have “open in current working directory” set, so if I want another tab or window pane in the same directory, I just need to hit ⌘ + N for a new window, ⌘ + T for a new tab, ⌘ + D to split my pane vertically, or ⌘ + ⇧ + D to split it horizontally. This is just muscle memory at this point (I actually had to test it out when writing this, because I couldn’t remember). That’s because I use this interaction dozens of times per day. I try to avoid using cd as much as I can, and I rely on fasd.

tmux

I’ll be honest: I’ve tried learning tmux a few times, but I’ve never been able to make it stick. That is, until I learned about tmux -CC, or control mode. George Nachman, the iTerm2 developer added this support to make a tight integration between tmux and iTerm.

Basically, you can take advantage of one of the most convenient features of tmux, pane splitting, and just rely on iTerm to handle it for you. This is especially useful if you need to connect to remote servers or even Docker containers on a regular basis.

For some time, I was developing inside of a Docker container, and it was tedious to consistently open a new terminal pane and run docker run -it container /bin/bash command again and again, and not to be able to take advantage of iTerm features. But, tmux and iTerm to the rescue! Instead, I only needed to run docker run -it container tmux -CC, and then could use iTerm as I normally would. Opening new tabs or windows, splitting panes, even keeping the same working directory, all worked as I would expect when using iTerm on my host machine!

Window Arrangement

As I mentioned earlier, I always keep at least six separate panes open to run various builds for the project I’m currently working on. Then, I’ll want some other sessions to use Git, run scripts, etc. It can be really tedious to open everything up again and again, to the point where I would never want to quit iTerm or shut my computer down.

But, in iTerm2, you can save window arrangements and quickly restore them. Each window and terminal pane opens in the same spot, in the same directory, with the right profile. I even have it send the appropriate start command to each pane for each dev server when it opens! All I need to do is press ⌘ + ⇧ + R when I open iTerm, and it opens all of the windows up and starts the dev servers.

Notable mentions + rapid fire

  • Composer is nice for long commands, and can be activated with ⌘ + ⇧ + ., but I tend to use readline features anyways.
  • Unlimited scroll back is a lifesaver. I have this enabled in all of my profiles.
  • Context aware ⌘ + Click. You can open a link in your browser, an IDE, an image editor. You can rely on native system settings, or you can always use certain applications.
  • Set + jump to marks. I love being able to go up through my commands, especially when there’s a ton of output by pressing ⌘ + ⇧ + UP.
  • Toggling timestamps is super convenient, especially to track what time you ran a command or to calculate the duration of a script.

Killer Features of the iTerm2 Terminal Emulator

I’m just scratching the surface of iTerm2 in this post. There’s so much more that it can do, and it’s obvious that George Nachman is the master in the terminal emulation space. This is such a thoughtful application, and I’m constantly impressed every time I discover a new killer feature.

I’d recommend that you give some of these a try, and just explore the settings menus of this terminal emulator application and see what else is out there.

 
Conversation

Join the conversation

Your email address will not be published. Required fields are marked *