[Python] Jupyter Notebook and Jupyter Lab Shortcuts Guide

Posted by

Jupyter Notebook and Jupyter Lab are essential tools for data scientists and developers. Using shortcuts in these environments can significantly boost productivity, so I’ve compiled a list of shortcuts to share. Use these shortcuts to work faster and more efficiently.

Frequently Used Shortcuts

ShortcutDescriptionMode
Shift + EnterRun cell and move to the next cellAll Modes
Ctrl + EnterRun cell and stay in the same cellAll Modes
Alt + EnterRun cell and insert a new cell belowAll Modes
EscSwitch to command modeEdit Mode
EnterSwitch to edit modeCommand Mode
AInsert cell aboveCommand Mode
BInsert cell belowCommand Mode
D, DDelete cellCommand Mode
MConvert cell to MarkdownCommand Mode
YConvert cell to codeCommand Mode
CCopy cellCommand Mode
VPaste cellCommand Mode
ZUndo cell deleteCommand Mode
Shift + MMerge cellsCommand Mode
Ctrl + SSave fileAll Modes
Ctrl + Shift + –Split cell at cursorEdit Mode

Note: The “Ctrl + Shift + -” shortcut for splitting cells also zooms out the screen in Chrome. If you’re using Chrome, you might need to change the shortcut settings in Chrome or Jupyter.


Modes

When working in Jupyter Notebook and Jupyter Lab, there are two main modes: Edit Mode and Command Mode. Each mode has its own set of shortcuts designed for specific tasks.

Edit Mode

Edit mode is used for editing the content of a cell. You can write code or enter text in this mode. In edit mode, the cell has a colored border, and the cursor is visible inside the cell.

Command Mode

Command mode is used for managing entire cells. You can add, delete, move cells, and change their types in this mode. When in command mode, the cell’s contents are not active.


Jupyter Notebook Shortcuts

Jupyter Notebook combines code execution and documentation, making it a powerful tool for managing data science projects. Here are some commonly used shortcuts in Jupyter Notebook.

Edit Mode

  • Esc: Switch to command mode
  • Ctrl + Shift + –: Split cell at cursor
  • Tab: Autocomplete code

Command Mode

  • Enter: Switch to edit mode
  • Shift + Enter: Run cell and move to the next cell
  • Ctrl + Enter: Run cell and stay in the same cell
  • Alt + Enter: Run cell and insert a new cell below
  • A: Insert cell above
  • B: Insert cell below
  • D, D: Delete cell
  • M: Convert cell to Markdown
  • Y: Convert cell to code
  • C: Copy cell
  • V: Paste cell
  • Z: Undo cell delete
  • Shift + M: Merge cells

Jupyter Lab Shortcuts

Jupyter Lab is an extended version of Jupyter Notebook with more powerful features. It supports all the shortcuts available in Jupyter Notebook and includes a few additional useful shortcuts.

Edit Mode

  • Ctrl + Shift + P: Open command palette
  • Ctrl + Shift + –: Split cell at cursor
  • Tab: Autocomplete code
  • Ctrl + ]: Increase indent
  • Ctrl + [: Decrease indent

Command Mode

  • Enter: Switch to edit mode
  • Shift + Enter: Run cell and move to the next cell
  • Ctrl + Enter: Run cell and stay in the same cell
  • Alt + Enter: Run cell and insert a new cell below
  • A: Insert cell above
  • B: Insert cell below
  • D, D: Delete cell
  • M: Convert cell to Markdown
  • Y: Convert cell to code
  • C: Copy cell
  • V: Paste cell
  • Z: Undo cell delete
  • Shift + M: Merge cells
  • Ctrl + Shift + P: Open command palette
  • F: Find and replace within cells
  • Ctrl + Shift + L: Select all matching text

Understanding and using these shortcuts in both modes will make your work in Jupyter Notebook and Jupyter Lab much more efficient. Mastering these shortcuts can significantly enhance your productivity.

Leave a Reply

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다