Control characters for terminal navigation and control.


Command

Action

Description

CTRL-w

Delete a word

This not only deletes a word, but it will also intelligently delete the last path element

CTRL-u

Delete to start of line

Delete from the cursor to the start of the line

CTRL-k

Delete to end of line

Delete from the cursor to the end of the line

CTRL-y

Paste

Yank the cut buffer and place it at the insertion point

CTRL-a

Start of line

Move the cursor to the start of the line

CTRL-e

End of line

Move the cursor to the end of the line

CTRL-c

SIGINT

I don't have to explain this one, surely

CTRL-d

EOF

End of file, close the stream (logout)

CTRL-l

Clear

Clears the terminal, does not wipe your current prompt if you are in the middle of editing

CTRL-r

Reverse search

Search backwards through your history to find a matching command. Press CTRL-r again to cycle through matches

CTRL-x CTRL-u

Incremental undo

Undo the last thing that happened to this prompt

CTRL-x *

Splat expand files

For instance, type ls * CTRL-x * and the splat will be glob expanded with matching files

CTRL-x CTRL-e

Edit the current command line in $EDITOR

Helpful for navigating very large command lines

CTRL-z

Suspend the process

Then you can bg it to shove it in the background or disown it to detach it from the shell

ESC-.

Insert last parameter from previous command

Immediately insert the last parameter used

!^

Repeat previous first parameter

When you hit enter, the first parameter of the previous command is inserted

!$

Repeat the last parameter

When you hit enter, the last parameter of the previous command is inserted (the non-interactive version of ESC-.

!!

Repeat the last command line

The whole line is inserted when you hit return

CTRL-\

SIGQUIT

Forcefully kill this process