Shortcuts jupyter notebook – Jupyter Notebook Keyboard Shortcuts | Most Useful Keyboard Shortcut Keys for Jupyter

Jupyter Notebook Keyboard Shortcuts: The article contains all the keyboard shortcuts and text snippets that any programmer would share with others during their long sessions of Pair Programming and have been well-received by a majority of the user. These mentioned can save a person countless hours programming and hope that such shortcut is capable of making someone start utilising some of these techniques to grow a more efficient programmer of Python. If a person spends two weeks practising Jupyter Notebook for analysis of data with Python, then will definitely use the shortcuts to compile a shortlist of all favourite keyboard shortcuts/the ones that most programmers use the most maximum.

For certain shortcuts, one must keep in mind that they can enter Command Mode (to perform actions of notebook-level) by simply pressing Esc, and they can return to Edit Mode (a.k.a. back to writing in cells) by pressing Enter. If a shortcut necessitates Command Mode, then one must specify Esc as the first key.

Wondering How to explore & learn Shortcut Keys for various Operating Systems, Computer Software Programs, Social media applications Keyboards? Here is the one-stop destination for all Keyboard Shortcuts, just take a look & memorize regularly for better performance in competitive exams & real-time situations.

Table Of Content

What is Jupyter Notebook?

Shortcuts jupyter notebook: Jupyter Notebook is extensively employed for data analysis. If a person started to learn Data Science 2–3 months ago and if they used this tool to explore some datasets (basically a collection of data). They will find that the notebooks documents are documents produced by the Jupyter Notebook App, which can accommodate both code (e.g. Python) and rich text elements like equations, links, paragraphs, etc. The Jupyter Notebook App is an application made for client-server that permits are running and editing notebook documents by a browser.

As a developer, one may prefer to use snippets and shortcuts as much as others do. The Jupyter Notebook App just makes writing code a lot simpler and faster. A programmer must follow one rule: If one started performing some action with the mouse, stop and recall if there is a shortcut present for the task. If there is one – apply it. When one starts using Jupyter Notebook, most of them were unaware of the fact that there are shortcuts for such a tool. Several times, one has to change their cell type from code to markdown, and most of them initially didn’t know-how.

As someone can guess, this caused a person a lot of headaches. To solve this issue, there is a Help > Keyboard Shortcuts link in the menu bar, and one finds that there are a ton of shortcuts present in that Jupyter NotebookIn addition to the shortcuts for the default keyboard, one can also define some of their own. This is accomplished by entering menu options “Help” > “Edit Keyboard Shortcuts” in the Notebook. One must scroll in the dialogue box until they find the action they want and then categorise the key combination in the “add shortcut” option present in the input box.

Note: A person needs to classify the keys by a hyphen (-). One should not forget to click the plus sign button to preserve the new shortcut!

Keyboard Shortcuts

Jupyter notebook hotkeys: In this article, the favourite shortcuts available in The Jupyter Notebook are table down.

First, we necessitate learning about the two modes in the Jupyter Notebook App: command mode and edit mode. And should also memorise all the shortcuts shared within the two modes.

Command mode vs Edit mode

Jupyter notebook keyboard shortcuts: Jupyter Notebooks have two distinct keyboard input modes, and it is something that to be aware of:

  1. Command mode- binds the notebook-level actions to the keyboard. Symbolised with a blue left margin and by a grey cell border.
  2. Edit mode- when a person is typing in a cell. Symbolised by a green cell border

Practice Jupyter Notebook

Jupyter notebook shortcuts: Practising a few minutes to learn specific shortcuts of the Jupyter Notebook keyboard will help an individual be a more efficient and experienced Python developer. These keyboard shortcuts are some of them that most professional developers found very useful.

These are the shortcuts that professionals practice in their daily work. If one still necessitate something that is not mentioned in these articles, then they can discover it in the keyboard shortcuts dialogue (H). One can also add more shortcuts or edit existing ones from the Help > Edit Keyboard Shortcuts connect in the menu bar. Clicking the loop will begin a dialogue. At the bottom of the tab, there are rules for editing or adding shortcuts. One needs to use hyphens – to designate keys that should be pressed at the same time. For example, a person added a shortcut Ctrl-R for the restart kernel and ran all cells command.

These shortcuts of the Jupyter Notebook are created on my Github repo that one can download and apply to practice these keyboard shortcuts.

Note: that the shortcuts mentioned below are for Linux and Windows users. Nevertheless, for Mac users, they’re distinctive buttons for Ctrl, Alt and Shift:

  • Ctrl: command key ⌘
  • Alt: option ⌥
  • Shift: Shift ⇧

These keyboard shortcuts are for Mac OSX and Jupyter version 4.1.0. For most below-mentioned shortcuts, one can replace cmd for ctrl for Linux or Windows. Or, one can utilise the H keyboard shortcut in Linux or Windows to confirm the appropriate keyboard shortcuts for those operating systems.

Command Mode

Keyboard Shortcuts Functions
shift + enter run the cell and then select below
ctrl + enter run cell
option + enter run cell, insert below
A insert cell above
B insert cell below
C copy cell
V paste cell
D, D delete selected cell
shift + M all the selected cells will be merged, or if only one cell is selected then the current cell with cell below
I , I to interrupt the kernel of the application
0, 0 to restart kernel with a dialog of the application
Y to change the cell to code mode
M change cell to markdown mode (good for documentation)
Enter enter edit mode
Shift+Enter run cell, select below
Ctrl+Enter run cell
Alt+Enter run cell, insert below
Y to code
M to markdown
R to raw
1 to heading 1
2,3,4,5,6 to heading 2,3,4,5,6
Up/K select cell above
Down/J select cell below
A/B insert cell above/below
X cut selected cell
C copy selected cell
Shift+V paste cell above
V paste cell below
Z undo last cell deletion
D delete selected cell
Shift+M merge cell below
Ctrl+S Save and Checkpoint
L toggle line numbers
O toggle output
Shift+O to let the user toggle output scrolling
Esc to close pager
H show keyboard shortcut help dialog
I interrupt kernel
0 restart kernel
Space scroll down
Shift+Space scroll up
Shift ignore
Enter take you into edit mode
H show all shortcuts
Up select cell above
Down select cell below
Shift + Up to extend above all the selected cells
Shift + Down extend selected cells below
A insert cell above
B insert cell below
X cut selected cells
C copy selected cells
V paste cells below
Shift + V paste cells above
D, D (required to press the key twice) to delete all the selected cells
Z in order to undo cell deletion
S to Save and mark a Checkpoint
Y to change the cell type to Code
M to change the cell type to Markdown
P to open the command palette.
Esc + s to save notebook
Esc + a (above), Esc + b (below) to create new cell
Ctrl + enter to Run Cell
c to Copy Cell
v to Paste Cell
Esc + i i to Interrupt Kernel
Esc + 0 0 to Restart Kernel
Esc + f to find and replace your code but not the outputs
Shift + M helps to merge multiple cells together

This dialog helps a person run any command by name. It’s really beneficial when one doesn’t have a shortcut for the required command or if one doesn’t know some shortcut.

While in Command Mode

  1. Press A to insert a new cell preceding the current cell,
  2. Press B to insert a new cell underneath.
  3. Press M to modify the current cell to Markdown,
  4. Press Y to transform it back to code
  5. Press D + D (press the key twice) to delete all the selected current cell
  6. Press Enter will take the programmer from the command mode terminal into edit mode for the assigned cell.
  7. Press Shift + Tab will display the user the Docstring (documentation) for the object the person has just typed in a code cell – they can continue pressing this shortcut to toggle through some modes of documentation.
  8. Press Ctrl + Shift + will actually split the current cell into two from where the person cursor is placed at that time.
  9. Press Esc + F helps to find and replace the code of the user but not the outputs.
  10. Press Esc + O to toggle all of the cell output.

Select Multiple Cells

Jupyter notebook shortcut: Press Shift + J or Shift + Down selects the next cell in a downwards direction. One can also select cells in an upwards direction by simply pressing Shift + Up or Shift + K.

Once cells are selected, one can then copy / cut / paste / run / delete them as a batch. This is convenient when one needs to move specific parts of a notebook.

One can also utilise Shift + M to merge multiple cells.

Edit Mode

One can press Enter to enable to be in Edit Mode

Esc takes the user into command mode

(press Enter to activate)

Keyboard Shortcuts Functions
cmd + click – helps in multi-cursor editing
option + scrolling click – enables column editing
cmd + / – toggle comment lines
tab – code completion or indent
shift + tab – tooltip
ctrl + shift + – split cell
Tab -code completion or indent
Shift+Tab -tooltip
Ctrl+] -indent
Ctrl+[ -dedent
Ctrl+A -select all
Ctrl+Z -undo
Ctrl+Shift+Z -redo
Ctrl+Y -redo
Ctrl+Home -go to cell start
Ctrl+Up -go to cell start
Ctrl+End -go to cell end
Ctrl+Down -go to cell end
Ctrl+Left -go one word left
Ctrl+Right -go one word right
Ctrl+Backspace -delete word before
Ctrl+Delete -delete word after
Esc -command mode
Ctrl+M -command mode
Ctrl+Shift+minus -split cell
Ctrl+S -Save and Checkpoint
Up -move cursor up or the previous cell
Down -move cursor down or next cell
Ctrl+/ -toggle comment on current or selected lines
Shift + Tab -tooltip
Ctrl + ] -indent
Ctrl + [ -dedent
Ctrl + A -select all
Ctrl + Z -undo
Ctrl + Shift + Z or Ctrl + Y -redo
Ctrl + Home -go to cell start
Ctrl + End -go to cell end
Ctrl + Left -go one word left
Ctrl + Right -go one word right
Ctrl + Shift + P -open the command palette
Down -move the cursor down
Up -move the cursor up

Select Multiple Cells

While in Command Mode

Command Mode

Keyboard Shortcut Keys for Jupyter

Text Snippets

Text snippets enable a person or a professional coder to keep things consistent and save time typing.

For any text snippets, the usual recommendation is Textexpander which is exclusively made for Mac OSX only. However, Windows users, can use PhraseExpress and in the past which serves well too.

For quick imports for all favourite packages of an individual user:

Constantly importing the same packages or/and forget what that package that a person always uses is named. People like to store their default imports in a snippet. The article recommends individuals create a similar snippet and tune it to their preferences.

  • To run the current cell: Press Ctrl + Enter
  • To run the current cell and move to the next one: Press Shift + Enter
  • To delete the current cell: Press Esc + D + D (double press)
  • To insert a new (code) cell above the current cell: Press Esc + A
  • To insert a new (code) cell below the current cell: Press Esc + B
  • To change the current cell’s type to markdown: Press Esc + M
  • To change the current cell’s type to code: Press Esc + Y
  • To collapse all cells: Press Ctrl + Shift + Left Arrow
  • To uncollapse all cells: Press Ctrl + Shift + Right Arrow
  • To restart kernel and run all cells: Press Shift + R
  • To Toggle all cells output collapsed (collapse all cells’ output): Press Ctrl + Shift + O
  • To Clear all cells output: Press Ctrl + Shift + Alt + O

Esc will take the person into command mode where they can navigate around their notebook with arrow keys.