To delete all content from a Jupyter notebook, you can follow these steps:
Step 1: Open the Jupyter Notebook
First, make sure you have the Jupyter Notebook open that you wish to clear.
Step 2: Clear All Outputs
If you only need to remove the outputs of each cell (but keep the code or Markdown content), you can do this easily via the notebook’s menu:
Go to Cell > All Output > Clear This will remove outputs from all cells, leaving the code or Markdown text intact.
Step 3: Delete All Cell Contents
If you want to remove all contents including code and Markdown:
Click on the first cell of your notebook.
Press Esc to ensure you are in command mode (where you can type keyboard shortcuts).
Press Shift + Down Arrow to select multiple cells downward one by one or keep pressing until all cells are selected.
Press D twice quickly (D, D). This shortcut deletes the selected cells.
Step 4: Save the Notebook
After clearing all cells, save the notebook to apply the changes:
Go to File > Save and Checkpoint
Alternatively, you can use a shortcut Ctrl + S (or Cmd + S on macOS) to save the notebook