Mastering Jupyter Notebook Commands

Posted June 6, 2023 by Rohith and Anusha ‐ 3 min read

Jupyter Notebook is a powerful and popular tool used by data scientists, researchers, and developers for interactive computing, data analysis, and documentation. It provides an environment where you can write and execute code, visualize data, and create rich text documents.

Creating and Managing Notebooks

  • Creating a new notebook is as simple as running the Jupyter Notebook application and clicking on New and then Python 3 (or any other desired kernel).

  • You can also create notebooks for different programming languages.

Notebook Modes

Jupyter Notebook offers two main modes: Command mode and Edit mode.

Command Mode

  • In this mode, you can execute commands that affect the notebook as a whole.

  • Press Esc to enter Command mode.

Edit Mode

  • In this mode, you can edit cells individually.

  • Double-click on a cell or press Enter to enter Edit mode.

Executing Code

  • To execute code in a cell, select the cell and press Shift + Enter.

  • This runs the current cell and moves the cursor to the next one.

  • You can also use Ctrl + Enter to run the current cell without moving the cursor.

Keyboard Shortcuts

Jupyter Notebook provides a variety of keyboard shortcuts to streamline your workflow. Here are a few essential ones:

  • Shift + Enter: Run cell and select the next cell.

  • Ctrl + Enter: Run cell and stay on the current cell.

  • Esc + A: Insert a new cell above the current cell.

  • Esc + B: Insert a new cell below the current cell.

  • Esc + M: Convert the current cell to a Markdown cell.

  • Esc + Y: Convert the current cell to a code cell.

  • Esc + D + D: Delete the current cell.

Markdown Cells

  • Jupyter Notebook supports Markdown cells for documentation and explanatory text.

  • You can format text using Markdown syntax, including headers, lists, links, images, and more. To execute a Markdown cell, press Shift + Enter.

Magic Commands

  • Magic commands are a set of commands specific to Jupyter Notebook that provide additional functionality.

  • They are preceded by the % symbol for line magic or %% for cell magic. Some useful magic commands include:

  • %run: Execute a Python script.

  • %timeit: Measure the execution time of a single statement or expression.

  • %load: Load the contents of a file into a cell.

  • %%bash: Run cell with Bash commands.

Interrupting and Restarting

  • If you want to stop the execution of a long-running cell, you can use the Interrupt Kernel button in the toolbar or press the I, I keys in Command mode.

  • To restart the kernel, use the “Restart Kernel” button or press the 0, 0 keys in Command mode.

Collaboration and Sharing

  • Jupyter Notebook allows you to share your work with others.

  • You can export notebooks as HTML, PDF, or slides. You can also share notebooks through platforms like GitHub or Jupyter Notebook Viewer.

  • Additionally, you can collaborate with others using tools like JupyterHub, JupyterLab, or Google Colab.


  • Jupyter Notebook is a versatile tool that empowers data scientists, researchers, and developers to perform interactive computing and data analysis.

  • By mastering essential Jupyter Notebook commands, you can enhance your productivity, streamline your workflow, and collaborate effectively with others.

  • Whether you’re working on data exploration, machine learning models, or sharing your findings, Jupyter Notebook commands will help you get the most out of this powerful tool.

quick-references blog

Subscribe For More Content