iTerm — Duplicate a Tab by Opening a New Tab in the Same Folder

Modern development environments sometimes require more than a single command line tab to run a project. For example, you may have a compile step to bundle up the final JavaScript file that will be delivered to the browser. Besides the frontend compilation, you may start a frontend or backend server handling incoming requests.

When using iTerm, you can create a key binding to duplicate an existing terminal tab and create a new session in the same folder. This tutorial walks you through the details on how to set up this keyboard shortcut!

Open a New iTerm Tab in the Same Folder

By default, there’s no keyboard shortcut to duplicate a tab for the same folder. Yet, you can create your own key binding. Here are the steps to create a keyboard short on your machine:

  • go to your iTerm settings (CMD + ,)
  • navigate to Keys
  • click the + sign (bottom left corner)
  • choose a key binding (I took CMD + SHIFT + t)
  • select the Duplicate Tab action
  • click OK to add your new binding

Add keyboard shortcut in iTerm to duplicate a tab

The new key binding shows up in the list and is usable without restarting iTerm. Sweet!

Added iTerm keyboard shortcut duplicating a tab

That’s it! You can now duplicate any iTerm tabs by pressing CMD + SHIFT + t at the same time on your keyboard.

Enjoy!

Explore the Library

Find interesting tutorials and solutions for your problems.