Ask Your Question
0

How to find full command history, including previous sessions?

asked 3 years ago

reynormalizer gravatar image

I'm trying to access all previous commands from the interactive sage shell, and I'm hoping to find something like .bash_history somewhere.

As far as I can tell, I can search previous commands by entering %hist, but this only gets me the session history. I can also go through each previous command one-by-one by hitting the up key, but that's a little too tedious for me. I think there is a file called history.sqlite at ~/.sage/ipython-5.0.0 but that's unreadable (and possible not from the interactive shell).

Is there a way to find the full history (or as much of it as is recently stored?)

Preview: (hide)

Comments

1

I think history.sqliteis the right file. There are various suggestions for how to access the full history at https://stackoverflow.com/questions/2..., including %history -g.

John Palmieri gravatar imageJohn Palmieri ( 3 years ago )

@John Palmieri Thanks, I had literally just found that post (after searching for 'ipython history') and came to add it as an answer! That's enough for what I want; if you enter your comment as an answer I can accept if you'd like.

reynormalizer gravatar imagereynormalizer ( 3 years ago )

1 Answer

Sort by » oldest newest most voted
1

answered 3 years ago

updated 3 years ago

I think history.sqliteis the right file. There are various suggestions for how to access the full history at https://stackoverflow.com/questions/2..., including %history -g for printing to the screen or %hist -o -g -f ipython_history.md which writes the history to a file. The link also discusses how to read the sqlitefile, and the Python sqlite3 interface (https://docs.python.org/3/library/sql...) could also help with that.

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 3 years ago

Seen: 1,077 times

Last updated: Oct 20 '21