13

I everyday try out my solutions before answering a pandas question in stack overflow . Usually after two to three days the jupyter notebook I use will be with n number of cells. Is there a way to delete all cells at once other than creating new notebook by deleting current one?

D D deletes one cell at a time.

3 Answers 3

30

You can delete all Jupyter notebook's cells at once as follows:

  1. Select all cells : ESC + SHIFT + DOWN (starting from the top)
  2. Then click ESC + D D (D twice)
Sign up to request clarification or add additional context in comments.

5 Comments

Awesome wasnt aware of selecting at all. Thank you @MedAli
how to undo deleted cell ?
@pyd click z in the keyboard
Still would be nice if Jupyter had a command to select all (Shift + down arrow is more of a "scrolling" solution). But this works.
To select all, indeed scrolling down with the down arrow takes a long time because everything is displayed. This is faster: select (click) the first cell, then scroll down with the window scrolling bar and SHIFT select the last cell. (JNB version 6.1.4.)
2
  • <ESC><CTRL-A> Select all cells
  • <ESC><D><D> Delete all selected cells

<ESC>P will bring up the list of commands and key bindings

1 Comment

Seeing this in 2025!. Really helpful shortcuts. Thanks
1
  1. Hit esc to exit edit mode
  2. Click to select the topmost cell you want to delete. in jupyterlab, a blue vertical line appears to the cell's left.
  3. Hit end to scroll to the bottom of the notebook
  4. Shift-click the last cell (similar to step 2) to select the range of cells to delete.
  5. Hit d, d to delete all the selected cells.

Hope that helps.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.