Editing files on Fox

Several command-line options exist for editing files on Fox.

Emacs

We highly recommend using the text mode when using Emacs, e.g.,

$ emacs -nw

If you wish to use the graphical user interface, then we recommend to run Emacs on your local computer and open the file remotely. For this you do not need to copy the files from the cluster to your local computer, you simply open them as you would open a remote web page in your browser. The procedure uses an Emacs package called TRAMP (Transparent Remote (file) Access, Multiple Protocol). See their web page https://www.gnu.org/software/tramp/ for more details:

(Thanks to Koen van Greevenbroek for input on TRAMP and two factor authentication)

Nano

Opening files on nano can be done with:

$ nano <filename>

You are ready to start editing right away. To save press Ctrl and O. To quit, use Ctrl-X.

You may wish to open a file in read-only mode, use the -v (for “view”) option:

$ nano -v <filename>

Vim

Opening files on vim can be done with:

$ vim <filename>

If editing a file, first press i to enter “insert” mode. Press the Escape key to exit insert mode. To save your changes, use a colon, then ‘w’: :w To quit, type: :q These commands can be combined to save and quit the editor :wq. To quit without saving changes, use :q! instead of :q

You may wish to open a file in read-only mode, use the -M option:

$ vim -M <filename>

This will disable you from modifying the file.


CC Attribution: This page is maintained by the University of Oslo IT FFU-BT group. It has either been modified from, or is a derivative of, "Editing files" by NRIS under CC-BY-4.0. Changes: Added additional sections "Nano" and "Vim" and updated "Emacs" with bullet point addressing compatibility between TRAMP and TFA on Fox.