Appendix A — Keyboard Shortcuts Reference
This appendix provides keyboard shortcuts for the command line, Vim, Jupyter, VS Code, Positron, and RStudio; the essential shell shortcuts are also in Table 5.1 and the editor shortcuts in Table 2.3. Platform differences (macOS versus Windows/Linux) are summarized at the end in Section A.9.
A.1 Bash/Terminal Shortcuts
Editing
| Shortcut | Action |
|---|---|
Ctrl+D |
Delete character under cursor (or logout if empty) |
Ctrl+H |
Delete character before cursor (backspace) |
Ctrl+W |
Delete word before cursor |
Alt+D |
Delete word after cursor |
Ctrl+K |
Delete from cursor to end of line |
Ctrl+U |
Delete from cursor to beginning of line |
Ctrl+Y |
Paste last deleted text (yank) |
Alt+Y |
Cycle through previously deleted text |
Ctrl+T |
Swap current character with previous |
Alt+T |
Swap current word with previous |
Alt+U |
Uppercase from cursor to end of word |
Alt+L |
Lowercase from cursor to end of word |
Alt+C |
Capitalize word |
Ctrl+_ |
Undo last edit |
History
| Shortcut | Action |
|---|---|
↑ or Ctrl+P |
Previous command in history |
↓ or Ctrl+N |
Next command in history |
Ctrl+R |
Reverse search through history |
Ctrl+S |
Forward search through history |
Ctrl+G |
Cancel history search |
Alt+. |
Insert last argument of previous command |
!! |
Repeat last command |
!$ |
Last argument of last command |
!* |
All arguments of last command |
!n |
Execute command number n from history |
!string |
Execute most recent command starting with string |
!?string |
Execute most recent command containing string |
^old^new |
Replace old with new in last command |
Process Control
| Shortcut | Action |
|---|---|
Ctrl+C |
Cancel/interrupt current command |
Ctrl+Z |
Suspend current process (move to background) |
Ctrl+D |
End of input / logout |
Ctrl+S |
Pause output (freeze screen) |
Ctrl+Q |
Resume output (unfreeze screen) |
Ctrl+L |
Clear screen (same as clear) |
Completion
| Shortcut | Action |
|---|---|
Tab |
Autocomplete command, filename, or variable |
Tab Tab |
Show all possible completions |
Alt+? |
Show possible completions |
Alt+* |
Insert all possible completions |
A.2 Screen/Tmux Shortcuts
GNU Screen
| Shortcut | Action |
|---|---|
Ctrl+A c |
Create new window |
Ctrl+A n |
Next window |
Ctrl+A p |
Previous window |
Ctrl+A " |
List windows |
Ctrl+A 0-9 |
Switch to window 0-9 |
Ctrl+A A |
Rename current window |
Ctrl+A d |
Detach from session |
Ctrl+A k |
Kill current window |
Ctrl+A S |
Split horizontally |
Ctrl+A \| |
Split vertically |
Ctrl+A Tab |
Switch between splits |
Ctrl+A X |
Close current split |
Ctrl+A [ |
Enter copy mode |
Ctrl+A ] |
Paste |
Tmux
| Shortcut | Action |
|---|---|
Ctrl+B c |
Create new window |
Ctrl+B n |
Next window |
Ctrl+B p |
Previous window |
Ctrl+B w |
List windows |
Ctrl+B 0-9 |
Switch to window 0-9 |
Ctrl+B , |
Rename current window |
Ctrl+B d |
Detach from session |
Ctrl+B & |
Kill current window |
Ctrl+B " |
Split horizontally |
Ctrl+B % |
Split vertically |
Ctrl+B ←→↑↓ |
Navigate panes |
Ctrl+B x |
Kill current pane |
Ctrl+B z |
Toggle pane zoom |
Ctrl+B [ |
Enter copy mode |
Ctrl+B ] |
Paste |
Ctrl+B ? |
Show all shortcuts |
A.3 Vim/Vi Shortcuts
Modes
| Key | Action |
|---|---|
i |
Enter insert mode (before cursor) |
a |
Enter insert mode (after cursor) |
I |
Insert at beginning of line |
A |
Insert at end of line |
o |
Open new line below |
O |
Open new line above |
v |
Visual mode (character) |
V |
Visual mode (line) |
Ctrl+V |
Visual mode (block) |
Esc |
Return to normal mode |
: |
Enter command mode |
Editing
| Key | Action |
|---|---|
x |
Delete character |
dd |
Delete line |
dw |
Delete word |
d$ |
Delete to end of line |
yy |
Copy (yank) line |
yw |
Copy word |
p |
Paste after cursor |
P |
Paste before cursor |
u |
Undo |
Ctrl+R |
Redo |
. |
Repeat last command |
r |
Replace character |
cw |
Change word |
cc |
Change line |
>> |
Indent line |
<< |
Unindent line |
Search and Replace
| Command | Action |
|---|---|
/pattern |
Search forward |
?pattern |
Search backward |
n |
Next match |
N |
Previous match |
* |
Search for word under cursor |
:%s/old/new/g |
Replace all in file |
:s/old/new/g |
Replace all in line |
:%s/old/new/gc |
Replace with confirmation |
Saving and Quitting
| Command | Action |
|---|---|
:w |
Save |
:w filename |
Save as filename |
:q |
Quit |
:q! |
Quit without saving |
:wq or :x |
Save and quit |
ZZ |
Save and quit (normal mode) |
ZQ |
Quit without saving (normal mode) |
A.4 Nano Shortcuts
Nano (Section 5.6.2) is the friendliest terminal editor and the one this book uses for quick edits on remote machines. Its on-screen help bar writes ^ for Ctrl and M- for Alt (the “Meta” key), so ^O in the help bar means Ctrl+O here.
| Shortcut | Action |
|---|---|
Ctrl+O |
Save (“write out”); press Enter to confirm the filename |
Ctrl+X |
Exit (prompts to save if there are unsaved changes) |
Ctrl+W |
Search (“where is”); Alt+W finds the next match |
Ctrl+\ |
Search and replace |
Ctrl+K |
Cut the current line |
Ctrl+U |
Paste the most recently cut line(s) |
Ctrl+A / Ctrl+E |
Move to beginning / end of line |
Ctrl+_ |
Go to a specific line (and optionally column) |
Alt+U / Alt+E |
Undo / redo |
Ctrl+C |
Show current cursor position (line, column) |
Ctrl+G |
Open nano’s built-in help |
A.5 Jupyter Notebook Shortcuts
Command Mode (Press Esc first)
| Shortcut | Action |
|---|---|
Enter |
Enter edit mode |
A |
Insert cell above |
B |
Insert cell below |
X |
Cut cell |
C |
Copy cell |
V |
Paste cell below |
Shift+V |
Paste cell above |
D D |
Delete cell |
Z |
Undo cell deletion |
Y |
Change to code cell |
M |
Change to markdown cell |
R |
Change to raw cell |
1–6 |
Change to markdown heading level 1–6 |
↑ / K |
Select cell above |
↓ / J |
Select cell below |
Shift+↑ |
Extend selection above |
Shift+↓ |
Extend selection below |
Shift+M |
Merge selected cells |
L |
Toggle line numbers |
O |
Toggle output |
Shift+O |
Toggle output scrolling |
I I |
Interrupt the kernel |
0 0 |
Restart the kernel |
S |
Save notebook |
H |
Show keyboard shortcuts |
Edit Mode (Press Enter in cell)
| Shortcut | Action |
|---|---|
Esc |
Enter command mode |
Ctrl+Enter |
Run cell |
Shift+Enter |
Run cell, select below |
Alt+Enter |
Run cell, insert below |
Ctrl+Shift+- |
Split cell at cursor |
Ctrl+S |
Save notebook |
Tab |
Autocomplete or indent |
Shift+Tab |
Tooltip/docstring |
Ctrl+] / Ctrl+[ |
Indent / dedent |
Ctrl+/ |
Comment/uncomment |
Ctrl+Z / Ctrl+Shift+Z |
Undo / redo within the cell |
The same command-mode and edit-mode shortcuts work in JupyterLab (including the JupyterLab served by Open OnDemand on Talapas, Section 20.4.3) and, with Ctrl replaced by Cmd on macOS, in notebooks opened inside VS Code or Positron.
A.6 VS Code Shortcuts
General
| Shortcut (Mac) | Shortcut (Windows/Linux) | Action |
|---|---|---|
Cmd+Shift+P |
Ctrl+Shift+P |
Command palette |
Cmd+P |
Ctrl+P |
Quick file open |
Cmd+, |
Ctrl+, |
Open settings |
Cmd+K Cmd+S |
Ctrl+K Ctrl+S |
Keyboard shortcuts |
| Ctrl+` | Ctrl+` | Toggle terminal |
Cmd+B |
Ctrl+B |
Toggle sidebar |
Cmd+Shift+E |
Ctrl+Shift+E |
Focus the Explorer (file tree) |
Cmd+Shift+F |
Ctrl+Shift+F |
Search across the whole project |
Ctrl+Shift+G |
Ctrl+Shift+G |
Source Control (Git) panel |
Cmd+Shift+X |
Ctrl+Shift+X |
Extensions panel |
Cmd+\ |
Ctrl+\ |
Split the editor |
Cmd+W |
Ctrl+W |
Close the current editor tab |
Cmd+Shift+N |
Ctrl+Shift+N |
New window |
Cmd+Shift+V |
Ctrl+Shift+V |
Markdown preview |
Cmd+Shift+K |
Ctrl+Shift+K |
Render/preview the Quarto document (Quarto extension, in .qmd files; in other files it deletes the line) |
The backtick (`) that toggles the terminal is on the key above Tab (shared with ~), not the apostrophe key. Note also that VS Code uses Ctrl, not Cmd, for this shortcut even on macOS.
Editing
| Shortcut (Mac) | Shortcut (Windows/Linux) | Action |
|---|---|---|
Cmd+X |
Ctrl+X |
Cut line (no selection) |
Cmd+C |
Ctrl+C |
Copy line (no selection) |
Alt+↑/↓ |
Alt+↑/↓ |
Move line up/down |
Shift+Alt+↑/↓ |
Shift+Alt+↑/↓ |
Copy line up/down |
Cmd+Shift+K |
Ctrl+Shift+K |
Delete line |
Cmd+Enter |
Ctrl+Enter |
Insert line below (in Positron: send line to console) |
Cmd+Shift+Enter |
Ctrl+Shift+Enter |
Insert line above |
Cmd+] / Cmd+[ |
Ctrl+] / Ctrl+[ |
Indent / outdent line |
Cmd+/ |
Ctrl+/ |
Toggle comment |
Shift+Alt+A |
Shift+Alt+A |
Toggle block comment |
Cmd+D |
Ctrl+D |
Select next occurrence |
Cmd+Shift+L |
Ctrl+Shift+L |
Select all occurrences |
Cmd+L |
Ctrl+L |
Select current line |
Cmd+Shift+\ |
Ctrl+Shift+\ |
Jump to matching bracket |
Cmd+F |
Ctrl+F |
Find |
Cmd+Alt+F |
Ctrl+H |
Find and replace |
Cmd+Shift+F |
Ctrl+Shift+F |
Find in files |
Multiple Cursors and Selection
| Shortcut (Mac) | Shortcut (Windows/Linux) | Action |
|---|---|---|
Alt+Click |
Alt+Click |
Insert an additional cursor |
Cmd+Alt+↑/↓ |
Ctrl+Alt+↑/↓ |
Insert cursor above/below |
Cmd+D |
Ctrl+D |
Add the next occurrence of the selection to the selection |
Cmd+F2 |
Ctrl+F2 |
Select all occurrences of the current word |
Shift+Alt+I |
Shift+Alt+I |
Insert a cursor at the end of each selected line |
Shift+Alt+Drag |
Shift+Alt+Drag |
Column (box) selection |
Cmd+U |
Ctrl+U |
Undo the last cursor operation |
Integrated Terminal
| Shortcut (Mac) | Shortcut (Windows/Linux) | Action |
|---|---|---|
| Ctrl+` | Ctrl+` | Toggle the terminal panel |
| Ctrl+Shift+` | Ctrl+Shift+` | Open a new terminal |
Cmd+\ |
Ctrl+Shift+5 |
Split the terminal |
Cmd+↑/↓ |
Ctrl+↑/↓ |
Scroll terminal by line |
Shift+PageUp/PageDown |
Shift+PageUp/PageDown |
Scroll terminal by page |
Inside the terminal panel the shell’s own shortcuts (Section A.1) apply, so Ctrl+C, Ctrl+R, and Ctrl+A/Ctrl+E behave as they would in a standalone terminal.
A.7 Positron Shortcuts
Positron (Section 2.5) is built on the same core as VS Code, so every shortcut in Section A.6 works unchanged. What it adds are data-science bindings, listed in Table A.21.
| Shortcut (Mac) | Shortcut (Windows/Linux) | Action |
|---|---|---|
Cmd+Enter |
Ctrl+Enter |
Send the current line or selection to the R/Python console |
Cmd+Shift+Enter |
Ctrl+Shift+Enter |
Run the current code chunk (Quarto) |
Cmd+Shift+M |
Ctrl+Shift+M |
Insert pipe \|> |
Alt+- |
Alt+- |
Insert assignment <- |
Cmd+Shift+K |
Ctrl+Shift+K |
Render/preview the Quarto document |
Cmd+Shift+V |
Ctrl+Shift+V |
Markdown preview |
Cmd+Shift+0 |
Ctrl+Shift+0 |
Restart the active interpreter (R or Python) |
F1 |
F1 |
Help for the function under the cursor |
A.8 RStudio Shortcuts
RStudio (Section 2.6) shares its core code-execution and Quarto bindings with Positron, so Table A.21 largely applies. The table below lists the ones specific to RStudio’s four-pane layout.
| Shortcut (Mac) | Shortcut (Windows/Linux) | Action |
|---|---|---|
Cmd+Enter |
Ctrl+Enter |
Run the current line or selection in the Console |
Cmd+Shift+S |
Ctrl+Shift+S |
Source (run) the whole script |
Cmd+Shift+Enter |
Ctrl+Shift+Enter |
Run the current Quarto chunk |
Cmd+Option+I |
Ctrl+Alt+I |
Insert a new code chunk |
Cmd+Shift+K |
Ctrl+Shift+K |
Render the Quarto document |
Cmd+Shift+M |
Ctrl+Shift+M |
Insert pipe \|> |
Option+- |
Alt+- |
Insert assignment <- |
Cmd+Shift+C |
Ctrl+Shift+C |
Comment / uncomment the selection |
Cmd+Shift+F10 |
Ctrl+Shift+F10 |
Restart the R session |
Ctrl+1 / Ctrl+2 |
Ctrl+1 / Ctrl+2 |
Move focus to Source / Console |
Cmd+Shift+F |
Ctrl+Shift+F |
Find in files |
Cmd+Shift+P |
Ctrl+Shift+P |
Command palette (search every RStudio command) |
F1 |
F1 |
Help for the function under the cursor |
A.9 Platform Differences
The tables above list macOS and Windows/Linux forms side by side where they differ. The general rule (Table A.23) is that the Ctrl of Windows and Linux becomes Cmd (⌘) on a Mac and Alt becomes Option (⌥), except in the terminal, in Vim, and in a few editor bindings that were inherited from the terminal (VS Code’s Ctrl+` and Ctrl+G, RStudio’s Ctrl+1–Ctrl+9 pane shortcuts), which keep Ctrl on every platform because the shell itself interprets those keys.
| Windows/Linux | macOS | Applies to |
|---|---|---|
Ctrl |
Cmd (⌘) |
Editors and IDEs (VS Code, Positron, RStudio, Jupyter) |
Alt |
Option (⌥) |
Editors and IDEs |
Ctrl+Alt |
Cmd+Option |
Editors and IDEs |
Ctrl |
Ctrl |
Bash, Vim, tmux/screen, and the integrated terminal |
On a Mac, Alt+B/Alt+F and the other Alt shortcuts in Section A.1 require the terminal to treat Option as Meta (Terminal: Settings → Profiles → Keyboard → Use Option as Meta Key; iTerm2: Profiles → Keys → Option key: Esc+). Without that setting, Option+F types “ƒ” instead of moving a word.
Every tool here lets you change its bindings, and it is worth doing for the few commands you use constantly:
- RStudio: Tools → Modify Keyboard Shortcuts…
- VS Code and Positron: File → Preferences → Keyboard Shortcuts (
Cmd+K Cmd+S/Ctrl+K Ctrl+S); bindings are stored inkeybindings.json, which you can keep in Git - Jupyter: Settings → Settings Editor → Keyboard Shortcuts (JupyterLab) or Help → Edit Keyboard Shortcuts (classic Notebook)
- Bash: readline bindings in
~/.inputrc
Learn the defaults first, though: they are what you will find on a collaborator’s laptop, on Talapas, and in every tutorial.