Millipede cluster user guide: working with Linux
The Linux command line prompt
After logging in you will be presented with a command prompt. Here you can enter commands for the login node. A nice introduction to using the Linux command prompt can be found at: http://www.linuxcommand.org/
Since this webpage already contains a nice tutorial on how to use the command line this information will not be copied here.
More information on Linux can also be found on the following websites:
- Machtelt Garrels, Introduction to Linux: http://tille.garrels.be/training/tldp/
- Scott Morris, The easiest Linux guide you’ll ever read: http://www.linuxinsight.com/files/easiest_linux_guide_ever.pdf
The Nano editor
Editing text files is often necessary to create or change for example input files or job scripts. The easiest editor available on the HPC cluster is nano. You can start nano by issuing the following command:
You can also start editing a file by issuing:
$ nano filename
When nano is started you will be presented with the screen shown in Figure 11. You can add text by simply typing what you want. The table at the bottom of the screen shows the commands that can be given to quit, save your text etc. These commands can be accessed by using <Ctrl>, denoted with ^ , together with the key given. <Ctrl>-X will for example quit the editor. <Ctrl>-O will save the current text to file, etc.
Another -probably easier- way to edit files is to use WinSCP. When double-clicking on a file stored on the cluster in WinSCP an editor will be fired up. When you save your changes the changed file will be transferred back to the cluster.
End-of-Line difference between Windows and Linux
A small problem you may run into is that there is a difference between Linux and Windows in the way “end of line” is represented. Windows represents the “end of line” by two characters, namely “carriage return” and “linefeed” (CRLF), where Linux uses a single “linefeed”. When editing a file created on Linux with e.g. Notepad on Windows, the file may appear as a single line of text with characters where the line breaks should be. A file created on Windows may appear to have extra “^M” characters at the line break positions on Linux systems.
Many current applications do not have problems recognizing the different form of “end of line” however. The WinSCP editor can handle both file types.When problems appear at the Linux side opening and saving the file with “nano” will solve the problem. Note, however, that most shell interpreters like bash or csh will have problems when the wrong “end of line” characters are used.
A file with the Windows CRLF end of line can be detected on Linux by using the command “file”. A Linux text file will result in the following output:
$ file testfiletestfile: ASCII textA Windows text file will give the following:
$ file testfile testfile: ASCII text, with CRLF line terminatorsThis does not work for shell scripts however. In this case the cat command can be used instead. When cat is used with the option –v, the file is shown as is, including the CR characters. This will result in ^M being displayed at the end of each line:
$ cat –v testfile
This is a textfile created on a MS Windows system^M
It has CRLF as linefeed^M
This may give problems on Linux systems^M
|Laatst gewijzigd:||17 januari 2017 10:22|