Skip to content

Instantly share code, notes, and snippets.

@stephancasas
Last active October 2, 2022 15:08
Show Gist options
  • Save stephancasas/1c82b66be1ea664c2a8f18019a436938 to your computer and use it in GitHub Desktop.
Save stephancasas/1c82b66be1ea664c2a8f18019a436938 to your computer and use it in GitHub Desktop.
A list of special control sequences you can send to tmux via the send-keys command.

Tmux Send-keys Prefixed Controls

When using the tmux send-keys command, these sequences can be used to control the cursor position or perform other special operations.

This reference is based on my own observations in tmux on Alpine Linux, as I could not find an actual reference for these.

Sequence Description
C-; Send literal "C-"
C-A Move cursor to home
C-B Move cursor to the left
C-C Send ^C escape
C-D Delete forward
C-E Move cursor to end
C-F Move cursor forward
C-H Backspace
C-I Doesn't seem to do anything
C-J Enter
C-K Cut input right of the cursor
C-M Enter
C-N Doesn't seem to do anything
C-O Enter
C-P Move cursor to end
C-Q Send ^Q escape
C-R Search for text including scrollback history
C-S Search for text in current view
C-T Shift cursor character backward one position
C-U Cut input left of the cursor
C-V Send ^V escape
C-W Cut input left of the cursor until next whitespace char
C-X It has some kind of effect on the paste buffer???
C-Y Paste previously-copied/cut input
C-Z Send ^Z escape

Example: clear the current shell input

tmux send-keys -t$mysession@mywindow 'C-E'
tmux send-keys -t$mysession@mywindow 'C-U'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment