Revision history [back]

You can use

%history

This works both in the Sage console and in the Jupyter notebook.

You can use

%history
%history -f my_session.sage

This works both saves all the sage commands typed during your session in the text file my_session.sage. Then, you can load this file in a new Sage console session by

In the Jupyter notebook, this loads all the saved commands in a single cell. In the Sage console, you will have to press Enter at the prompt ...: to rerun the commands and possibly enter n to the question 

File u'my_session.sage' exists. Overwrite?

This occurs because the %history command has been saved in the Jupyter notebook.file my_session.sage and therefore is run again when you load the file.

An alternative is to use %attach as described in @"John Palmieri'"s answer.

You can use

%history -f my_session.sage

This saves all the sage commands typed during your session in the text file my_session.sage. Then, you can load this file in a new Sage session by

In the Jupyter notebook, this loads all the saved commands in a single cell. In the Sage console, you will have to press Enter at the prompt ...: to rerun the commands and possibly enter n to the question

File u'my_session.sage' exists. Overwrite?

This occurs because the %history command has been saved in the file my_session.sage and therefore is run again when you load the file.

An alternative is to use %attach as described in @"John Palmieri'"s @John_Palmieri's answer.

You can use

%history -f my_session.sage

This saves all the sage commands typed during your session in the text file my_session.sage. Then, you can load this file in a new Sage session by