What do you mean my "Terminal"?
If you are referring to a terminal like OSX Terminal, or some GUI terminal (xterm, konsole, gnome-terminal, etc) in Linux, then you can simply use whatever editor (say, kate, kwrite, gedit, etc) you have present to edit the sage file. If you want to launch the editor from within sage then you need to give an exclamation mark before launching it. Like
sage: !gedit /path/to/file.sage
If you want to only view the file and not edit it, then you can run something like
sage: !less /path/to/file.sage`
and when you are done viewing press q
to exit.
If you are on a console in Linux, then you can use less
to view the file as shown above or nano
to edit the file: !nano /path/to/file.sage
. In nano
, the options that are possible are listed at the bottom of the screen.
You can run the file in three ways. First way is to run the following command in the command prompt (not the sage:
prompt):
/path/to/sage /path/to/file.sage
The next two ways can be used from within Sage, when you are in the sage:
prompt.
use attach
which continuously monitors the file for changes.
sage: attach "/path/to/file.sage"
use load
which runs the file only once and doesn't monitor it for changes.
sage: load("/path/to/file.sage")
Look at the help by running attach?
and load?
to learn about their syntax and other examples.