Meta on a Mac Delivers Efficiency Boost
By default, there's no Meta or Alt key in the Mac Terminal instead you have to hit ESC, which is hard on the hands, being way up there on the left. I've been intermittently cursing this for years now, until finding out only just this week there's a setting to fix it.Tip of the Trade: Tired of stretching your fingers to hit the ESC key on your Mac? There's a simple way to fix that.
Go to the Preferences menu in Terminal, open the Keyboard tab and there's a clicky-box for "Use option as meta key," and there you go the option key (next to the Apple key) now works as your Alt or Meta key. There's a similar option available for iTerm.
In X11, it's a little more complicated. By default, the Apple key operates as the Alt/Meta key. However, the X11-specific keyboard shortcuts (e.g., Apple-N for a new xterm) will override this. One situation I've come across where this is a problem is the shortcut Apple-1 (e.g., Apple-2 and Apple-3). This allows you to switch between windows, but it also overrides Alt-[num], which is used to pass numeric arguments into readline.
You can use ESC-[num] instead, or you can untick the "Enable key equivalents under X11" in the Preferences menu. This disables the menu shortcut override for all commands that have a value in readline. Apple-N will no longer create a new xterm; instead, it will be interpreted as Alt-N, and it will start a non-incremental forward search. Similarly, Alt-[num] will work as expected. The way you choose to set this option depends on whether you find the readline commands or the X11 menu keyboard shortcuts more useful, but it's reassuring to know the choice is there.
Juliet Kemp has been messing around with Linux systems, for financial reward and otherwise, for about a decade. She is also the author of "Linux System Administration Recipes: A Problem-Solution Approach" (Apress, 2009).