ipython notebook clear all code

In Jupyter, do the following to clear all cells:

  1. Press Esc to enter command mode.
  2. Hold Shift. Select the first and last cells to select all cells.*
  3. Press d twice to delete all selected cells.

Alternatively, if you simply want to try out code, consider running the ipython console, which is purely interactive in the REPL and does not require creating a new file. In a command prompt, type:

> ipython

Demo

Click outside the textbox to select a cell in command mode (thanks @moondra's).

Command Mode (Yes)

enter image description here

Edit Mode (No)

enter image description here


You can type dd to remove current selected cell. And if you continously press dd you can clean the screen.


Well, you could use Shift-M to merge the cells (from top) - at least there's only one left to delete manually.