Matthew West

Remote Access to Linux Machines

This page describes how to connect to a remote Linux machine and run computational jobs on it from an OS X laptop. The basic connection method discussed here is SSH, described in more detail below. We consider three different methods of running jobs remotely:

  1. nohup: a simple and easy-to-use system for running text-based computational jobs that require no user interaction.
  2. screen: a more complex text-based system that allows remote text-based sessions to be disconnected and reconnected, allowing for long-running interactive jobs.
  3. VNC: a remote graphical desktop. See here for details.

Format conventions

On this page, commands that you should type at a local (on your laptop) and remote (on the Linux server) command prompt will respectively be written like:

local$ commandname -opt
remote$ commandname -opt
In each case, just type the text after "local$ " or "remote$ " (in this case "commandname -opt").

Local commands should be run in the Terminal program, while remote command should be run by first connecting to the remote machine with ssh, like this:

local$ ssh
remote$ remotecommand


SSH is a text-based connection method. From a Terminal in OS X you can run
local$ ssh
to connect to the remote machine Some useful tricks with SSH include:


Normally any commands running will be killed when you logout of a remote machine. To stop this happening we can use the nohup command like this:
remote$ nohup <commandname> [arguments] &
With MATLAB it is necessary to disable the graphical environment first with
remote$ unset DISPLAY
remote$ matlab -r "<commandname>; quit" &
where commandname.m is an m-file in the current directory. When using nohup, output from the command is written to the file nohup.out. To write it to another file, use
remote$ nohup <commandname> [arguments] > output.txt &
to write to the file output.txt, for example.


To be completed.