IPython can query or export command statement history
2026-05-07 | 2 mins | 73 words
Today i learned that you can use the “magic” %history command in IPython to query the command history of the active session but also all the recorded past sessions.
For example you can go like %history 999/1-500 -f /tmp/outfile to write the lines 1 to 500 of the recorded session 999 to the file at tmp directory.
There are other ways of retrieving the history, but this seems the most elegant to me.