James Mullaney's Homepage

Publications (ADS)

Running processes remotely in OS X

Use the GNU software "screen" if you want to keep running scripts in the background after you've logged out. Here I've outlined some basic instructions for using screen (full manual available here)

"screen" is shipped as standard with OS X. Start it (on the command line) with:
>> screen

Once screen has started, use it as a normal terminal. To run a command in the background, issue the command followed by an ampersand, e.g.:
>> command parameters &

If you want to catch the output and any error messages, use:
>> command parameters &> command.log &
(Track progress using tail -f command.log)

To leave screen while keeping the process running in the background you must detach (rather than simply exit) the current screen using the keystroke command:
Ctrl-A d

When you detach, you'll leave the screen environment, but the session remains active meaning any ongoing processes in screen keep running.
Each time you start screen, it opens a new session. To list the current screen sessions use:
>> screen -ls

To attach to a given session use:
>> screen -r name_of_session
(If only one screen is detached, you can simply use: >> screen -R)

To kill a screen session, attach to that session and issue the command:
Ctrl-A k

Dr. James Mullaney

Room F19
Hicks Building
University of Sheffield
S3 7RH, U.K.


Phone: +44 (0)114 22 23512

Fax: +44 (0)114 22 23555

Skype: dph3jrm
Last Updated: 18/06/15