How to clear Jupyter Notebook’s output in all cells from the Linux terminal?

nbconvert 6.0 should fix --clear-output

The option had been broken for a long time previously, bug report with merged patch: https://github.com/jupyter/nbconvert/issues/822

Usage should be for in-place operation:

jupyter nbconvert --clear-output --inplace my_notebook.ipynb

Or to save to another file called my_notebook_no_out.ipynb:

jupyter nbconvert --clear-output \
  --to notebook --output=my_notebook_no_out my_notebook.ipynb

This was brought to my attention by Harold in the comments.

Before nbconvert 6.0: --ClearOutputPreprocessor.enabled=True

Same usage as --clear-output:

jupyter nbconvert --ClearOutputPreprocessor.enabled=True --inplace my_notebook.ipynb
jupyter nbconvert --ClearOutputPreprocessor.enabled=True \
  --to notebook --output=my_notebook_no_out my_notebook.ipynb

Tested in Jupyter 4.4.0, notebook==5.7.6.

Leave a Comment