Clearing the screen in IPython
To clear the screen on Windows, use !CLS
.
On Unix-like systems, use !clear
.
A shell command is executed by the operating system if prepended by an exclamation mark. See http://ipython.readthedocs.io/en/stable/interactive/reference.html#system-shell-access.
Note that commands should also work without the exclamation mark if they are defined as aliases. See http://ipython.readthedocs.io/en/stable/interactive/shell.html?#aliases.
There is also a Ctrl+L shortcut for clearing the screen. See http://ipython.readthedocs.io/en/stable/config/shortcuts/index.html#single-filtered-shortcuts.
You can bind it to the common Ctrl-l shortcut by putting this into your ~/.ipython/ipythonrc
:
readline_parse_and_bind "\C-l": clear-screen