ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 28 Apr 2020 15:45:57 +0200There is a way to forget the history of the prompt?https://ask.sagemath.org/question/51079/there-is-a-way-to-forget-the-history-of-the-prompt/ 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.Mon, 27 Apr 2020 20:49:27 +0200https://ask.sagemath.org/question/51079/there-is-a-way-to-forget-the-history-of-the-prompt/Answer by Sébastien for <p>I'm using sagemath 9.0 in kubuntu 19.10, I can start it in the console just calling <code>sage</code>, 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?</p>
<p>Googling I find some related things but nothing works, I tried the commands <code>!clear</code> (this just clear everything that is shown in the console, but not the history of sage), also <code>%clear in</code> and <code>%clear out</code>, that are IPython commands to delete some history, but they didnt work with the described kind of history.</p>
https://ask.sagemath.org/question/51079/there-is-a-way-to-forget-the-history-of-the-prompt/?answer=51105#post-id-51105One 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`.Tue, 28 Apr 2020 15:45:57 +0200https://ask.sagemath.org/question/51079/there-is-a-way-to-forget-the-history-of-the-prompt/?answer=51105#post-id-51105Answer by slelievre for <p>I'm using sagemath 9.0 in kubuntu 19.10, I can start it in the console just calling <code>sage</code>, 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?</p>
<p>Googling I find some related things but nothing works, I tried the commands <code>!clear</code> (this just clear everything that is shown in the console, but not the history of sage), also <code>%clear in</code> and <code>%clear out</code>, that are IPython commands to delete some history, but they didnt work with the described kind of history.</p>
https://ask.sagemath.org/question/51079/there-is-a-way-to-forget-the-history-of-the-prompt/?answer=51092#post-id-51092Sage'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.
Tue, 28 Apr 2020 11:26:54 +0200https://ask.sagemath.org/question/51079/there-is-a-way-to-forget-the-history-of-the-prompt/?answer=51092#post-id-51092