RStudio keyboard shortcuts
Running code, the console, panes, debugging, and packages in the RStudio IDE.
55 shortcuts Mac and Windows checked September 14, 2026
Print all 55 shortcuts One sheet with every shortcut in this app, ready for the printer or a PDF.
- RStudio Documented
| Action | Keys | Row actions |
|---|---|---|
| Move the cursor to the console Anywhere | Mac Ctrl2 1 more variant | Source |
| Clear the console Console | Mac CtrlL 1 more variant | Source |
| Interrupt the running command Console | Mac Esc 1 more variant | Source |
| Change the working directory Anywhere | Mac CtrlShiftH 1 more variant | Source |
| Go to a file or function Anywhere | Mac Ctrl. 1 more variant | Source |
| Move the cursor to the source editor Anywhere | Mac Ctrl1 1 more variant | Source |
| Toggle the document outline Source editor | Mac CmdShiftO 1 more variant | Source |
| Open a document Anywhere | Mac CmdO 1 more variant | Source |
| Save the active document Source editor | Mac CmdS 1 more variant | Source |
| Save every document Anywhere | Mac CmdOptionS 1 more variant | Source |
| Close every open document Anywhere | Mac CmdShiftW 1 more variant | Source |
| Knit, preview or compile the document Source editor | Mac CmdShiftK 1 more variant | Source |
| Insert a code chunk Source editor | Mac CmdOptionI 1 more variant | Source |
| Insert a code section Source editor | Mac CmdShiftR 1 more variant | Source |
| Run the current line or selection Source editor | Mac CmdReturn 1 more variant | Source |
| Run the whole document Source editor | Mac CmdOptionR 1 more variant | Source |
| Run from the start to the current line Source editor | Mac CmdOptionB 1 more variant | Source |
| Run from the current line to the end Source editor | Mac CmdOptionE 1 more variant | Source |
| Run the current code section Source editor | Mac CmdOptionT 1 more variant | Source |
| Run the current chunk Source editor | Mac CmdOptionC 1 more variant | Source |
| Source the current document Source editor | Mac CmdShiftS 1 more variant | Source |
| Fold every section Source editor | Mac CmdOptionO 1 more variant | Source |
| Unfold every section Source editor | Mac CmdShiftOptionO 1 more variant | Source |
| Go to a line Source editor | Mac CmdShiftOptionG 1 more variant | Source |
| Go to the next section Source editor | Mac CmdPage Down 1 more variant | Source |
| Go to the previous section Source editor | Mac CmdPage Up 1 more variant | Source |
| Extract a function from the selection Source editor | Mac CmdOptionX 1 more variant | Source |
| Extract a variable from the selection Source editor | Mac CmdOptionV 1 more variant | Source |
| Reindent the lines Source editor | Mac CmdI 1 more variant | Source |
| Comment or uncomment lines Source editor | Mac CmdShiftC 1 more variant | Source |
About RStudio and its shortcuts
RStudio is organised around the loop of writing code, running it and reading the result, and its shortcuts follow that loop: send a line or a selection to the console, navigate between the four panes, knit a document, and search the help. The pane navigation commands are what make it feel like one program rather than four windows.
RStudio lets you modify its bindings, and some commands depend on the project type or on whether you are editing a notebook, a script or a document. Desktop and server versions can also differ where the browser intervenes.
Where the RStudio keys came from
Read from 1 documentation page published by the makers of RStudio. Report a key that is wrong
To see how one action is done in other apps as well as RStudio, browse the shortcuts by task. Shortcuts by task