Apr 07 2022 · Aleksandra Płońska, Piotr Płoński

PDF cheatsheets for 32 Jupyter Notebook Shortcuts

Jupyter Notebook shortcuts bannerThe keyboard shortcuts make you fast as ninja. The faster you can provide the software to analyze data or solve engineering problem the better. In this article we show you Jupyter Notebooks keyboard shortcuts that you need to know. Learning shortcuts might take a while. We created a PDF ready to print with shortcuts for Mac, Windows and Linux users. It is available at the end of the article.

Two modes for shortcuts

There are two modes of Jupyter Notebook for accepting shortcuts:

  • edit mode,
  • command mode,

The edit mode is available when we have coursor blinking in the cell. You can switch it on by clicking in the cell text area. If you click in the cell but outside the text area, then you need to hit Enter on the keyboard to activate the edit mode. The exit from edit mode please press Esc button.

Blinking coursor in the text area means that edit mode is available

The command mode is available when the coursor is not blinking in the cell text are. You can switch it on with Esc button. You will see that the border color around the cell is changing when you switch the modes.

There are some shortcuts that work in both modes, and there are shortcuts that only work in the selected mode.

Mac users

If you are a Mac users please use the following mapping for (Ctrl, Shift and Alt):

  • a command key for Ctrl
  • a key for Shift
  • a key for Alt

Shortcuts for both modes

  • Ctrl + Enter - it executes the current cell. One of the most important shortcuts :)
Execute cell with Ctrl+Enter
  • Alt + Enter - it executes the current cell and insert a code cell below.
Execute cell and insert new code cell below Alt+Enter
  • Shift+Enter - it executes the current cell and switch the focus to the cell below. If you are in the last cell, then a new code cell will be inserted at the end.

  • Ctrl+S - it saves the notebook and checkpoint.

Shortcuts for command mode

  • Enter switch to edit mode
  • h - it shows all keyboard shortcuts.
Shortcuts pallete with h key
  • Up - it changes the selected cell to the above cell,
  • Down - it changes the selected cell to the below cell,
  • a - inserts the code cell above,
  • b - inserts the code cell below,
  • x - cuts the selected cell,
  • c - copies the selected cell,
  • v - pastes the cell below,
  • Shift+v - pastes the cell above the current cell,
  • double d - deletes the selected cell,
  • z - undoes the cell deletion,
  • y - changes the cell type to Code,
  • m - changes the cell type to Markdown,
  • r - changes the cell type to Raw,
  • Shift + Space - scrolls notebook up,
  • Space - scrolls notebook down,
  • p - opens the command pallete. You can search for any command there and execute.
Command pallete with p key

Shortcuts for edit mode

Shortcuts for edit mode are very similar as in the most text editors in advance IDEs.

  • Esc - exits from edit mode to command mode,
  • Tab - code completion,
  • Ctrl + ] - increases indentation,
  • Ctrl + [ - decreases indendation,
  • Ctrl + a - select all text in the code,
  • Ctrl + z - undoes previous action,
  • Ctrl + Home - goes to the cell start,
  • Ctrl + End - goes to the cell end,
  • Ctrl + Right - goes one word right,
  • Ctrl + Left - goes one word left,

Add custom shortcuts

You can easily add a custom shorcut. Please go to Help -> Edit Keyboard Shortcuts. It will open a dialog where you can search for a command and write a shortcut. You need to separate a keys with -. I want to add a custom shortcut Ctrl + 5 for restart kernel and run all cells, so I need to write Ctrl-5. Please check the animation below:

Add custom shortcut

Shortcuts in PDF

Below are images with links for Jupyter Notebook shortcuts cheatsheets in PDF format that are perfect for print (please click on selected image to download PDF version). You can find all PDFs in our repository. Enjoy! :)

Shortcuts for Mac users in color

Shortcuts for Mac users in color

Shortcuts for Mac users in gray

Shortcuts for Mac users in gray

Shortcuts Windows or Linux users in color

Shortcuts Windows or Linux users in color

Shortcuts Windows or Linux users in gray

Shortcuts Windows or Linux users in gray

Summary

The keyboard shortcuts can greatly speed-up the process of software development. The more shortcuts you remember and use the more productive you are. The Jupyter Notebook provides two modes for accepting shortcuts. The command mode helps you navigate through the cells and notebook. The edit mode is for text and code editing.

Become a Data Science wizard, today!

Forget about Python problems, just do your work.

MLJAR Studio