Shell keyboard shortcuts

Author

Jelmer Poelstra

Published

August 4, 2023



Caution

PAGE STILL UNDER CONSTRUCTION

Shell keyboard shortcuts

Shortcut Command
Tab Tab completion (double Tab shows options when there are multiple)
/ Cycle through command history
Ctrl + C Cancel/abort/kill current process or “incomplete command” (get prompt back)
Alt/Escape+. Paste last argument of last command
Ctrl + D Exit the current shell (/ interactive job) (exit)
Ctrl + L Clear your screen (clear)
Ctrl/Command+C Copy selected text (can also be Ctrl+Shift+C)
Ctrl/Command++V Paste copied text (can also be Ctrl+Shift+V)
Ctrl+A Move cursor to beginning of line
Ctrl+E Move cursor to end of line
Ctrl+U Cut text to beginning of line
Ctrl+K Cut text to end of line
Ctrl+W Cut previous word
Ctrl+Y Paste (“yank”) previously cut element
Ctrl + R Enter characters to search for in the history (repeat CTRL + R to keep going back, ENTER to put command in prompt)
  • Ctrl+U actually cut the text: “Yank” it back with Ctrl+Y.

Getting the last word from the previous command

This is (perhaps surprisingly) very useful!

Create a directory for yourself using mkdir:

mkdir /fs/ess/PAS1855/users/$USER/rnaseq_intro/sandbox/testdir

Move into this dir using cd – after typing cd and a space, press Alt+. on Windows or Esc+. on a Mac:

cd /fs/ess/PAS1855/users/$USER/rnaseq_intro/sandbox/testdir

Another press will go back to the last word of the second-to-last command, and so on. On Windows, you can keep Alt pressed while repeatedly pressing . (convenient), but on a Mac, you’ll need to release Esc in between successive presses.

Back to top