Ask Your Question

There is a way to forget the history of the prompt?

asked 2020-04-27 20:49:27 +0100

Masacroso gravatar image

I'm using sagemath 9.0 in kubuntu 19.10, I can start it in the console just calling sage, then it starts the sage prompt. However I noticed that with the arrows up and down I can see the commands that I had written in the prompt days ago. My question is: there is a way to clear this history?

Googling I find some related things but nothing works, I tried the commands !clear (this just clear everything that is shown in the console, but not the history of sage), also %clear in and %clear out, that are IPython commands to delete some history, but they didnt work with the described kind of history.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2020-04-28 11:26:54 +0100

slelievre gravatar image

Sage's prompt relies on IPython.

The history is stored in a file called history.sqlite.

To figure out where this file is, run this from a terminal (without the initial $ which represents the shell prompt):

$ sage --ipython locate profile default

Then change to the directory given by the above command, and remove the history.sqlite file.

A fresh one will be created next time you start Sage.

edit flag offensive delete link more

answered 2020-04-28 15:45:57 +0100

Sébastien gravatar image

updated 2020-04-28 15:50:43 +0100

One solution is:

sage -ipython history clear

You may also just trim the history to keep only the last let's say 1000 commands with sage -ipython history trim, see documentation of sage -ipython history -h.

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

1 follower


Asked: 2020-04-27 20:49:27 +0100

Seen: 141 times

Last updated: Apr 28 '20