Ask Your Question

Revision history [back]

Here are several options:

  • as @FrédéricC says, create a file with a .sage extension containing your commands, say my_file.sage, and then while running Sage, use the command %attach /path/to/.../my_file.sage. Using %attach means that if you edit the file while Sage is running, it will automatically reload it, re-executing all of the commands.

  • if you don't mind a non-text file, you can save your Sage session: see http://doc.sagemath.org/html/en/tutorial/interactive_shell.html#saving-and-loading-complete-sessions. (I've never actually done this, but I use %attach all the time.)