Jupyter Notebook Command Mode Keyboard Shortcuts

Starting with IPython 2.0, the Jupyter Notebook has two modes:

  1. edit mode
  2. command mode.

Keyboard will behave differently depending upon which mode you have selected.

Command mode

Grey cell border is a sign that command mode is enabled. In command mode, we can edit the notebook as a whole, but not type into individual cells. The keyboard is mapped to a set of shortcuts that let you perform notebook and cell actions efficiently. You can enter command mode by pressing Esc or using the mouse to click outside a cell’s editor area.

Following table shows some of important shortcuts for command mode;

Command              Description
Enter enter into edit mode
Shift-­Enter run current cell, and select cell below
Ctrl-Enter run cell
Alt-Enter run cell, insert below
Y to code
M to markdown
R to raw code
1 to insert heading 1
2,3,4,5,6 to insert heading 2,3,4,5,6
K select cell above
J select cell below
A insert cell above
B insert cell ­below
X cut selected cell
C copy selected cell
Shift-V paste cell above
V paste cell below
Z undo last cell deletion
D,D delete selected cell
Shift-M merge cell below
Ctrl-S Save and Checkpoint
L toggle line numbers
O toggle output
Shift-O toggle output scrolling
Esc close pager
H show keyboard shortcut help dialog
I,I interrupt kernel
0,0 restart kernel
Space scroll down
Shift-­Space scroll up
Shift ignore

Got A Data Science Question?

Ask our experts anything about machine learning, analytics or statistics.