Zum Hauptinhalt springen

IPython can query or export command statement history

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.