Editing files

It is best to create your jobscripts directly on the cluster. This ensures that you don’t get errors, whilst submitting or running jobs on the cluster.

Files imported from Windows

File formatting differs significantly between Windows and Linux.  Files created on Windows will cause errors when run on ADA.
It is better to rewrite the file in a new file on the cluster rather than import it from Windows.

If you have files created under Windows that you can't recreate on ADA, you will need to convert the formatting on the file to a Linux based format.

dos2unix filename.txt

Full details can be found using

man dos2unix


There are many editors available for Linux, however the most common are briefly outlined below. Nano is arguably the most simple for the first time user, Vi and emacs are more powerful, while nedit is good for those used to a windows environment. Which to use is down to personal preference.

Below is a very brief guide to each, with some of the most common commands highlighted. As with most apps, copy and paste via the mouse (highlight and middle mouse button with putty or exceed for instance) are available as well as internal copy and paste commands.


nano (formerly pico) is probably the simplest standard editor and appears at first glance as most Windows text editors do.

Create or edit a file

nano jobscriptname.sub

If the filename doesn't exist, a blank page opens ready for composition, if filename does exist then the file is opened for editing. Unlike many console apps, nanocan't be put to the background with CTRL Z. Start with nano -w filename to turn word wrap off

Save CTRL + o
Exit CTRL + x (then confirm
Cut line CTRL + k (within nano only)
Paste line CTRL + u (within nano only)
Find CTRL + w (then enter search string
Find again CTRL + w
Find line number CTRL + w CTRL + t
Next page CTRL + v
Previous page CTRL + y
Help CTRL + g



nedit is a simple graphical editor, which can be customised and functionality extended using macros.  Details of customising nedit.

Vi and gvim

vi (vim- "vi iMproved") is a more powerful but more complicated tool, allowing for elegant mass editing of text. Vi can be started either with the traditional vi filename or when lessing a file, by pressing v (note exiting vi here will return to the less view). Vi has many commands allowing for all sorts of editing shortcuts, the most common presented below. Unlike Nano and Windows editors, a new vi session does not immediately allow you to write, instead you must invoke the insertion mode (i or a etc). Pressing ESC then exits the editing mode and returns you to reading mode, enabling you to save etc. Part of benefit of vi is the ability to incorporate sed commands into the editing, which is very useful, lots of instructions available through search engines.

gvim is a gui version of vi which may be more intuitive for a beginner.

Save :w
Save and exit :wq
Exit :q!
Insert (before cursor) i (ESC to exit)
Append text (after cursor) a (ESC to exit)
Open new line below o (ESC to exit)
Delete line dd
Copy line yy
Delete word dw
Change word cw
Copy line yy
Paste p
Find :/searchphrase
Find again /
Next page CTRL + f
Previous page CTRL + b
Undo u

Click here for an vim reference card.


Similar to vi, emacs is a more powerful editor. It allows users to create macros and fine grained customisations. The emacs short cut keys are the ones used for the BASH shell. There is a plethora of documentation and good books available on emacs, with support for the many programming languages, LaTeX and shell scripting. Below is a screen shot of emacs.

To edit a file in emacs

emacs -nw jobscriptname.sub

The most common emacs functions :



Exit CTRL x + CTRL c
Load filename CTRL x + CTRL f filename
Cut line CTRL k
Paste line CTRL y
Find forward CTRL s
Find reverse CTRL r
Beginning of document ESC <
End of document ESC >
Page up ESC v
Page down CTRL v
Upper case word ESC u
Lower case word ESC l


Click here for an emacs reference card.