Ask Your Question

how to delete all programs, inputs and output in the sage console ?

asked 2020-07-25 00:12:50 -0500

andriam gravatar image

updated 2020-07-25 01:14:57 -0500

I've tried all commands I know : reset(), !clear, %clear i, -ipython history clear, ipython history trim, --ipython locate profile default to clear history in my sage console but all of these do not work ,


edit retag flag offensive close merge delete


Hello, @andriam! In my case, writing reset() deletes all user-defined variables, and then clear cleans the console. Could you be more specific about your problem? What do you want to achieve? Perhaps and example?

dsejas gravatar imagedsejas ( 2020-07-25 07:14:02 -0500 )edit

If the goal is to clear the ipython history, this was asked and answered at

The rest of my comment expands on the comment by @dsejas.

If the goal is to recover the state of variables at the start of Sage, use

sage: reset()

If the goal is to get a clean terminal window with a fresh sage prompt and none of the previous computations visible, use

sage: clear

Note that after this clear command, you can still scroll back to see the previous input and output.

Of course, maybe what you really want to do is hit Ctrl+D to leave Sage, close the terminal window, open a new terminal window, and start a new fresh Sage session.

slelievre gravatar imageslelievre ( 2020-07-25 11:15:07 -0500 )edit

Hello, I want to clear all history what I have written on the console and all of the oitputs of all time so that onlly the word "sage :" remains in the console. That is, when I scroll back, I don't want to see all previous history

andriam gravatar imageandriam ( 2020-07-26 02:19:49 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2020-08-04 03:23:33 -0500

dan_fulea gravatar image

Just start a new console and a new sage process inside it.

edit flag offensive delete link more


Thanks to dan_fulea, this is what I use for the moment, but when scrolling back, using the back arrow, I still find the past history

andriam gravatar imageandriam ( 2020-08-06 01:53:53 -0500 )edit

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-07-25 00:12:50 -0500

Seen: 60 times

Last updated: Jul 25