Tool cheatsheet
Jupyter Cheatsheet
Run notebooks with JupyterLab, use IPython magics, register kernels, convert notebooks and run them from scripts.
Install and launch
- Install JupyterLab — Install JupyterLab into your environment.
- Start JupyterLab — Start the server and open the browser at http://localhost:8888.
- Run without a browser — Start the server without opening a browser, for use on a remote machine (then tunnel the port over SSH).
- Start the classic Notebook — Start the single-document Jupyter Notebook interface.
- List running servers — Show running servers and their tokens.
Kernels and environments
- List kernels — Show the kernels Jupyter can use.
- Register an environment as a kernel — Make a virtual environment selectable in notebooks.
- Remove a kernel — Unregister a kernel you no longer use.
- Install a package from a notebook — Use the % magic so pip installs into the notebook's own environment.
IPython magics and tips
- Time a statement — Run a statement many times and report the average. %%timeit does the same for a whole cell.
- Time a cell — Report how long the whole cell took to run once.
- Show plots inline — Display Matplotlib charts below the cell.
- Reload edited modules automatically — Pick up changes to imported .py files without restarting the kernel.
- Run a shell command — Prefix a command with ! to run it in the shell.
- Show help for an object — Append ? to see documentation, or ?? to see the source.
- Display rich output — Show several values in one cell, such as DataFrames and images.
- List variables in memory — Show the variables defined in the notebook.
Convert and automate
- Convert to HTML — Export a notebook as a standalone HTML page.
- Convert to a Python script — Export the code cells as a .py file.
- Run a notebook from the command line — Execute every cell and save the results in a new notebook.
- Run a notebook with parameters — Run a notebook with different parameters. Tag one cell "parameters" to define the defaults. Needs papermill installed.
- Keep outputs out of Git — Remove outputs and metadata before committing, so diffs stay small. Needs nbstripout.
- Learn the key shortcuts — Shift+Enter runs a cell and moves on. Esc enters command mode, where A and B insert cells above or below, DD deletes a cell, M makes markdown and Y makes code.
Related cheatsheets
- Ansible 2 cheatsheet — Run ad-hoc commands and playbooks, manage inventories, roles, collections and secrets with Ansible.
- Argo CD 3 cheatsheet — Install Argo CD, define Applications declaratively, and manage sync, diffs, history and rollbacks with the argocd CLI.
- AWS CLI 2 cheatsheet — Configure credentials and manage S3, EC2, Lambda, logs, containers and secrets with the AWS CLI v2.
- Azure CLI 2 cheatsheet — Sign in and manage resource groups, VMs, web apps, storage, Kubernetes, registries and secrets with the az command.
- Bash and Linux 5 cheatsheet — Everyday shell and Linux commands for files, searching text, permissions, processes and servers.
- Claude API cheatsheet — Call Claude from Python, TypeScript or curl: messages, streaming, thinking, tools, structured output, caching, batches and error handling.