Skip to content
Tutorials Center
My learning

Topics

Lesson 3 of 39 ยท Getting Started

The Notebook Interface

A guided tour of the Jupyter interface: the file browser, notebook toolbar, menus, cell types, kernel status indicator, and the operations you use to arrange cells.

When you open a notebook in Jupyter, you see a document divided into rectangles called cells, with a menu bar and a toolbar above. This lesson is a map of that screen, so that every later lesson can say "use the Run menu" or "check the kernel status" and you know exactly where to look. The names below follow current JupyterLab and Jupyter Notebook 7; both share the same ideas and most of the same wording.

Jupyter cannot run on this site, so there are no screenshots. We describe each area in words and use small Python stand-ins to practise the operations on a list of cells.

The file browser (the launcher)

When the server starts, the first screen shows files and folders. In JupyterLab the left sidebar holds a file browser and the main area shows a Launcher with big buttons:

  • Notebook: create a new notebook, one button per available kernel (for example "Python 3 (ipykernel)").
  • Console: an interactive prompt attached to a kernel, without a document.
  • Terminal: a real shell, running on the machine that hosts the server.
  • Text file, Markdown file, Python file: plain editors.

In the classic Notebook app the same file list has a New menu at the top right. Click a .ipynb file name to open it in a new tab. A green icon in the list means the notebook has a running kernel.

You can also upload files, create folders, rename, duplicate and delete from this view. Deleting here removes the file from disk.

The notebook window

An open notebook has these regions from top to bottom:

  1. The tab title: the file name, with a dot or circle when there are unsaved changes (modern versions autosave every two minutes by default).
  2. The menu bar: File, Edit, View, Run, Kernel, Settings (or Tabs), Help.
  3. The toolbar: icon buttons for save, add cell, cut, copy, paste, run, stop (interrupt), restart, restart and run all, and a drop-down for the cell type.
  4. The cells: the stack of code and Markdown cells.
  5. The status area: the kernel name on the right of the toolbar, with a small circle showing whether the kernel is idle or busy, and a status bar at the bottom of JupyterLab.

What each menu is for

Menu Typical items
File New, Open, Save Notebook, Rename, Download, Export As (HTML, PDF, Markdown, script), Close and Shut Down
Edit Cut, Copy, Paste cells, Delete, Split, Merge, Move cell up or down, Clear outputs, Find and Replace
View Show line numbers, collapse or expand outputs, toggle the header
Run Run selected cell, Run all cells, Run all above or below the selected cell
Kernel Interrupt, Restart, Restart and run all, Change kernel, Shut down
Help Keyboard shortcuts, documentation links

You rarely need all of these. In practice you use Run, Kernel โ†’ Restart and File โ†’ Save, and later the keyboard shortcuts covered in Modes and keyboard shortcuts.

Cells and their three states

Each cell has a type and a state.

  • Types. A code cell holds executable code; a Markdown cell holds formatted text; a raw cell holds text that no tool will interpret (rarely used). Pick the type from the toolbar drop-down.
  • Prompt. To the left of a code cell you see In [ ]: when it has never run, In [*]: while it runs, and In [3]: after it finished, where 3 is the order in which the kernel executed it. The matching output has Out [3]: if the cell's last expression returned a value. JupyterLab shows these as [ ], [*] and [3].
  • Selection. The selected cell has a coloured bar at its left edge: blue when you are in command mode, green (classic) or a cursor in the text area when you are in edit mode.
stateDiagram-v2
    [*] --> NeverRun: "[ ]"
    NeverRun --> Running: Shift+Enter
    Running --> Finished: "[1]"
    Finished --> Running: run again
    Running --> Finished: output appears

The execution counter in the prompt tells you in which order cells really ran.

Arranging cells

Building a notebook means adding, moving and combining cells. The common operations are:

  • Insert a cell above or below the selected one (A or B in command mode, or the + button).
  • Delete a cell (D twice) or undo the delete (Z).
  • Cut, copy and paste whole cells.
  • Move a cell up or down (drag its left margin, or use the Edit menu).
  • Split a cell at the cursor and merge the selected cell with the one below.
  • Change type with M (to Markdown) and Y (to code).

The following stand-in treats a notebook as a Python list of cells so you can practise the logic of these operations and see why a merge or a split can change what your notebook means:

Python Stand-in: arrange cells like a notebook

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice that moving cells does not move the data: variables live in the kernel, not in the cell. That is the root of many confusing bugs, discussed in Execution order and hidden state.

Saving, checkpoints and exports

  • Save with Ctrl+S (Cmd+S on macOS). Autosave also writes the file every couple of minutes.
  • The old Notebook app kept a checkpoint (a hidden copy in .ipynb_checkpoints) that you could return to with File โ†’ Revert to Checkpoint. JupyterLab still creates checkpoints in that folder, so add .ipynb_checkpoints to your .gitignore.
  • Download gets a copy on your own machine; Export As converts to HTML, PDF, Markdown or a plain .py script.

The next stand-in imitates how a prompt label changes when cells run in an order different from their position:

Python Stand-in: prompt numbers follow execution order

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does the prompt In [*]: next to a code cell mean?

    The asterisk means the kernel is executing or has queued that cell. When it finishes it turns into a number.
  2. 2. Which menu contains Restart and Interrupt?

    Interrupt, Restart, Restart and run all, and Change kernel all belong to the Kernel menu.
  3. 3. You close the notebook tab. Is its kernel necessarily stopped?

    Closing a tab does not always stop the kernel; use Shut Down Kernel or File, Close and Shut Down.
  4. 4. Moving a cell up in the notebook does what to the variables in memory?

    Cell order on the page does not change what the kernel already holds in memory.

Summary

  • The launcher or file browser creates and opens notebooks, consoles, terminals and text files.
  • A notebook window has a menu bar, toolbar, a stack of cells and a kernel status indicator.
  • Cells are code, Markdown or raw; the prompt number shows execution order, [*] means running.
  • Use Insert, Delete, Move, Split and Merge to shape a notebook.
  • Save often, know where checkpoints live, and use Export As for other formats.
  • Cell position and memory are different things.

Next: Writing and running your first notebook