Command Line shortcuts: a cheatsheet

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

Ctrl-AMove to start of line
Ctrl-EMove to end of line
(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

(Esc-then-# on a Mac)
Comment out the current command from the start of the line
Ctrl-_Incremental undo of command line edits
(lower L)
Clear screen (like the clear command but isn’t saved in history)
Ctrl-wDelete the previous word on the command-line (before the cursor)
Ctrl-uDelete 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