%history magic function in ipython

In an ipython REPL the %history magic function can be used to show command history and save it to a file.

%history - prints the history

%history -f <file> - dumps the history to <file>