To run a command or script in the background on Polaris and Andes, an ampersand (&) can be added to the line. The code itself can be changed to write outputs to a file, rather than to the terminal.
For instance, running code (a Python script) at the command line in Polaris:
python myscript.py
Can be changed to:
python myscript.py &
To run in the background.
To print to file, in Python:
# write to a new file or overwrite an existing file, using \n to insert a line break / carriage return -- save this as a .py file and run at the command line with a trailing &
with open('myfile.txt', 'w') as f:
f.write('Line 1 text.\n')
If a script is already running, but needs to be sent to the background for processing, use ctrl z and then type bg to send the script-process into the background.
It is also possible to launch additional terminals to assist with this type of processing. After logging in to Polaris (or Andes) using ssh -X netid@polaris.dartmouth.edu, the command xterm & will launch another terminal window and allow you to continue using the original terminal. The -X switch allows for using a display window through the terminal connection (also known as x11 forwarding or x forwarding)