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 for more details:
- In order for TRAMP to recognize and handle the Two Factor Authentication prompt on Fox, add the following to your Emacs init file before
(require 'tramp)and any other TRAMP configuration you might have:
(add-to-list 'password-word-equivalents "One-Time_Code") - Open emacs on your laptop/machine
- C-x C-f (Ctrl+x, then Ctrl+f (or Mac equivalent), then you will get a 鈥渇ind file鈥 prompt)
- /ssh:username@fox.educloud.no:pathname (note the leading slash)
- You may get the following message 鈥淥ffending key for IP in 鈥. Are you sure you want to continue connecting (yes/no)?鈥 type yes and enter
- Depending on the network state you might see the message 鈥淲aiting for prompt from remote shell鈥 for few seconds to a minute, before the connection opens.
For example if your user name is 鈥渘ewuser鈥 and if you want to open a file called 鈥渕yfile.txt鈥, located in your home area on Fox, you would use the following: /ssh:newuser@fox.educloud.no:/cluster/home/newuser/myfile.txt
If you specify a directory name, you can browse the remote file system until you have found the file you wish to open.
(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 鈥渧iew鈥) option:
$ nano -v <filename>
Vim
Opening files on vim can be done with:
$ vim <filename>
If editing a file, first press i to enter 鈥渋nsert鈥 mode. Press the Escape key to exit insert mode.
To save your changes, use a colon, then 鈥榳鈥: :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 探花精选 IT FFU-BT group. It has either been modified from, or is a derivative of, "" by NRIS under . Changes: Added additional sections "Nano" and "Vim" and updated "Emacs" with bullet point addressing compatibility between TRAMP and TFA on Fox.