top of page
  • Writer's pictureMagdalena Konkiewicz

Jupyter Notebook Keyboard Shortcuts for Beginners


Photo by cocoparisinenne on Pixabay


When you start with Jupyter notebook most of the people use the menu bar above the cells to do basic operations. This is not the most time-efficient way to do them, therefore, I want to show the most basic keyboard shortcuts of Jupyter notebook that you will use every time you open the editor.


This article is not a complete list of all possible shortcuts in the notebook but focuses on the ones that you will be using most frequently and therefore learning them at the beginning of your Jupyter notebook journey is essential.



Command mode versus edit mode

In order to understand how to use keyboard shortcuts in Jupyter, it is important to understand the command mode and edit mode.

Edit mode is when you are editing one of the cells within the notebook and all the text you type is entered in the cell you are currently editing (either code or markdown).

Command mode, on the other hand, is the opposite of the edit mode. It is a mode when we are not editing any cell within the notebook, so you are not writing any code or editing text. This is the time when one of the cells is highlighted and the keyboard shortcuts can be used. Al the shortcuts you will use will refer to the highlighted cell.



Switching between command mode and edit mode

The last thing before presenting you with the list of important shortcuts is to learn how to switch between modes and luckily it is trivially simple.

  • Enter takes you out from command mode and you enter into edit mode on the cell that was highlighted.

  • Esc takes you out from the edit mode into command mode. The cell that you were editing becomes highlighted now and all the commands that you enter now will refer to this highlighted cell.


Image by stux from Pixabay

Command mode keyboard shortcuts

Now that you understand the difference between the command mode and edit mode you can use these keyword shortcuts to speed editing of the jupyter notebook.

  • a add a new cell above the current one,

  • b add a new cell below the current one,

  • d + d (d pressed twice) deleting current cell,

  • m change cell from code to markdown,

  • y change cell from markdown to code,

  • up and down arrows use arrows to change the current cell,

  • shift + enter (pressed together) run code in the cell.



Summary

I have presented you with the most basic jupyter notebook shortcuts that I guarantee you will find useful every time you will be working with Jupyter notebook. Using these keyboard shortcuts together with understanding basics about edit and command mode will make you more comfortable with the Jupyter editor and hopefully will speed up your coding in no time.

Happy practice!

1,101 views1 comment

Recent Posts

See All
bottom of page