Jupyter Notebook Cheat Sheet
Jupyter Notebook reference covering magic commands, shell integration, cell types, and essential keyboard shortcuts for efficient interactive computing.
1 PageBeginnerMar 25, 2026
Common Magic Commands
Line and cell magics for the IPython kernel.
python
%matplotlib inline # render plots inline%timeit sum(range(1000)) # time a single line%%time # time a whole cell (must be first line)%who # list variables in the current namespace%load_ext autoreload%autoreload 2 # auto-reload modules on change!pip install requests # run a shell command
Cell Magics & Shell
Write files and run shell scripts from a cell.
python
%%writefile script.pyprint("hello from a generated file")%%bashecho "runs as a bash script"ls -la%run script.py # execute an external .py file%pwd # print working directory
Keyboard Shortcuts
Command mode shortcuts (press Esc first).
- Esc, A- insert a new cell above
- Esc, B- insert a new cell below
- Esc, D D- delete the selected cell
- Shift+Enter- run cell and select the next one
- Ctrl+Enter- run the cell in place
- Esc, M- convert cell to Markdown
- Esc, Y- convert cell to code
Cell & Kernel Concepts
Building blocks of a notebook document.
- Code cell- executes in the kernel and shows output below
- Markdown cell- renders formatted text, LaTeX, and images
- Raw cell- passed through unmodified during nbconvert (no execution)
- Kernel- the language runtime (ipykernel for Python) executing your code
- Checkpoint- autosaved notebook snapshot used for recovery
Pro Tip
Restart the kernel and run all cells top-to-bottom (Kernel > Restart & Run All) before trusting a notebook's results — out-of-order execution during interactive editing easily leaves you with state that won't reproduce from a fresh run.
Was this cheat sheet helpful?
Explore Topics
#JupyterNotebook#JupyterNotebookCheatSheet#DataScience#Beginner#CommonMagicCommands#CellMagicsShell#KeyboardShortcuts#CellKernelConcepts#MachineLearning#CommandLine#CheatSheet#SkillVeris