Home

Delete Entire Word in Terminal and iTerm2

Ever find yourself holding down the Delete key on the command line? Here's a way to work faster.

When you type something you don't want to run on the command line it can be annoying to hold down delete until everything you want to remove is gone.

There is always the nuclear option, in which you cancel the current command with ctrl+c and start over.

But often it would be better to delete one word at a time, as you can in most text editing programs on Mac. The standard pattern is option+delete. But that doesn't work as expected out of the box with Terminal or iTerm2. Here's how you can set it up.

Setting Up option+delete in Terminal

  1. Open Terminal and go to preferences (cmd+,).
  2. Navigate to Profiles, then the Keyboard tab.
  3. Check Use Option as Meta key.
Option+Delete in Terminal

Setting Up option+delete in Terminal

  1. Open iTerm2 and go to preferences (cmd+,).
  2. Navigate to Profiles, then the Keys tab.
  3. Choose Esc+ for one or both option keys.
Option+Delete in iTerm2

Let's Connect

Keep Reading

Deleted 3 Apps Thanks to Raycast

Raycast has boosted my productivity while also covering the offerings of three applications I was using.

Dec 09, 2022

Never Lose Copied Text Again!

If you’re constantly copying and pasting and losing what is on your clipboard, here’s the perfect solution!

Dec 13, 2022

Emergencies Are Usually Self-Inflicted

An emergency in the business world is stressful. Many times we bring those emergencies on ourselves. It's time to put a stop to it!

Feb 12, 2016