Ask Your Question
1

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

asked 5 years ago

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.

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
2

answered 5 years ago

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.

Preview: (hide)
link
2

answered 5 years ago

Sébastien gravatar image

updated 5 years ago

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.

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

1 follower

Stats

Asked: 5 years ago

Seen: 1,017 times

Last updated: Apr 28 '20