jb… a weblog by Jonathan Buys

Delete Previous Word or Path Item in Terminal

Jump to Post

In pretty much any Cocoa app, option-delete is an incredibly useful shortcut to delete the previous word or path component. If you mess up typing a word, for example, you can start fresh instead of having to use the mouse/trackpad or hit backspace multiple times. For paths, it’s great for when you want to remove a few components from the end of a path.

In Terminal, however, this is not possible by default. You can enable a command in the Edit menu called “Use Option as Meta Key” and it will restore this Cocoa editing behavior.

Pair this with the ZSH auto-suggestions, and good grief is this going to save me so many backspaces. 16 years I’ve been using that terminal, had no idea that’s what this option did.