in ipython
, I can use %hist
or %history
to print recent history, but this only prints history from current session.
I would like to print all history, similar as bash history
command does.
What I am trying to do is to get complete history, so that I can then search with regex, see what commands followed after specified commands, and so on
Speaking of history, can it also print timecodes?
SIDE NOTE:
In bash, I have written a simple script which prints history and I can grep it for keywords. I see times when certain commands were executed. I can specify -A n
or -B n
, where n
is a number of lines AFTER
or BEFORE
a given command.
This is very handy, because I can easily find what I did when, and what followed, ...
I am looking for something similar for ipython
~/.ipython/profile_default/
. In there you'll find the tables:sessions
(with timestamps),history
andoutput_history
.ipython
?%history -g
will show you all of it.-g
searches the history, and if you give it no pattern, you get everything.%history -g -f filename
to save it to file.