DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

thomasvanholder
thomasvanholder

Posted on

6 Useful Terminal Shortcuts for iTerm2

Orginally published at Medium on Dec 16th 2020.

Are you looking to become a better developer by creating an empowering digital workflow? iTerm2 will help you to make the most of your day behind the keyboard. It’s the terminal that has all the functionality a developer ever wished for.

The guide below will help you to:

  1. Download and install iTerm2
  2. Set up a hotkey shortcut β€” Double tab option ( βŒ₯)
  3. View timestamps
  4. Highlight and comment on logs
  5. Autocomplete β€” Command (⌘) plus semicolon (;)
  6. Click links from the terminal β€” Command (⌘) plus click
  7. Focused troubleshooting

At first, it seems like the native terminal on a Macbook Air or Macbook Pro comes with all the functionality you need β€” that is, until you discover that there are much more powerful alternatives than the default Mac terminal.

As developers, we engage in a high number of repetitive tasks during a given day. A craftsman needs the right tools to build, and so do we. Any change that enables us to work a little smarter, a little more efficiently, will have a significant impact on our developer productivity. All the few seconds here and there end up to countless hours over and over again.

iTerm2’s tagline is β€œthe features you didn’t know you’d love.” And that’s indeed a pretty accurate way to describe it. Your terminal, together with your IDE, is the backbone of writing applications and code. The goal is to make coding as enjoyable as possible by optimizing how you work, by having a smooth transition from one workflow to another.

Even the simplest of tools can empower people to do great things.

Below is an overview of a minimal setup for some of iTerm2's most-loved features. If, after reading this guide, you’d like to know more, check the official iTerm2 documentation for other powerful ideas to boost your productivity.

1. Download and Install iTerm2


2. Set Up Hotkey Shortcut (Double-Tap β€˜Option ( βŒ₯) β€˜)

Hotkey 1

The terminal window will pop up as the full width of your screen with a slightly transparent background. This makes it possible for you to read what’s behind the terminal, useful when you’re watching a video with setup instructions. By double-tapping the hotkey again, the terminal window minimizes and you go back to the editor or website you were working in.

Go to Preferences > Keys > Hotkey > Create a Dedicated Hotkey Window

Hotkey 2

Hotkey 3

Great, you are set up! Now close and restart your iTerm2 editor. By double-tapping the option key, the editor will appear from the top of your screen.

When the terminal window is opened, you can press the combination Command (or Cmd) ⌘ + Enter to make the window full-screen size.


3. View Timestamps

Go back in time and find earlier logs and comments. On the right screen of your terminal window, you can easily retrace back your steps in time.
timestamp1
Timestamps


4. Highlight and Comment on Logs

Troubleshooting log files can be complex and hard. The lines of code to read in a log can be overwhelming. Help yourself and your teammates by highlighting and commenting on sections to resolve your bugs more quickly.

Highlight1
Highlight2


5. Autocomplete β€” Command (⌘) Plus Semicolon (;)

Press the Command key (⌘) and semicolon (;) at the same time to autocomplete terminal actions performed earlier.

Autocomplete


6. Click Links From the Terminal β€” Command (⌘) Plus Click

No need to copy a link, manually open the browser, and paste the link. You can easily click any link or file within your terminal and be redirected automatically.

Click link


7. Focused Troubleshooting

If you are overwhelmed by the number of logs, you can isolate part of the code. Inspect part of the terminal output by selecting the code followed by Command (⌘) plus Option ( βŒ₯) plus Z. The selected code is now visible in a new tab window. Press Escape to exit and return to the main editor window.

Logs

Top comments (3)

Collapse
kamusis profile image
Kamus

Thank you for sharing the experience.
Did you find after "cmd+option+z", then ESC to the original screen, will make the scroll bar disappeared. you can not scroll the screen anymore (usually use the 2 fingers to swipe down) until you close the session and re-open it.

Collapse
kamusis profile image
Kamus

My iTerm2 version: Build 3.5.0beta5

🌚 Browsing with dark mode makes you a better developer by a factor of exactly 40.

It's a scientific fact.