I confess, I’m 100% indebted to the @climagic Twitter account for these. But I wanted to collect some of their keyboard shortcut tips here for reference. I’ve started with a Twitter “Moment” but then listed the shortcuts to in case Twitter ever ceases to exist.
Twitter Moment
Shortcuts list
Shortcut | Effect |
Ctrl-A | Move to start of line |
Ctrl-E | Move to end of line |
Meta-. (Esc-then-. on a Mac) | Insert last argument from previous line of command history. Press multiple times to cycle through the last arguments of the history |
Meta-# (Esc-then-# on a Mac) | Comment out the current command from the start of the line |
Ctrl-_ | Incremental undo of command line edits |
Ctrl-l (lower L) | Clear screen (like the clear command but isn’t saved in history) |
Ctrl-w | Delete the previous word on the command-line (before the cursor) |
Ctrl-u | Delete everything from the cursor to the beginning of the line |
There is also a really useful document on the differences between last argument reference methods