Ask Your Question
0

How to find full command history, including previous sessions?

asked 2021-10-20 17:35:06 +0100

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?)

edit retag flag offensive close merge delete

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 ( 2021-10-20 18:52:56 +0100 )edit

@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 ( 2021-10-20 19:03:53 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-10-20 23:57:43 +0100

updated 2021-10-20 23:58:35 +0100

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.

edit flag offensive delete link more

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: 2021-10-20 17:35:06 +0100

Seen: 67 times

Last updated: Oct 20