A Linux crash course : Some basics
(c) SUSE Linux

While 'Windows' is nowadays the standard operating system, the alternative 'Linux' is becoming more and more popular. For example, almost all computers of our internal network run under Linux - first, because it is an extraordinarily stable and versatile operating system for networks and second, because many scientific programs are preferably or exclusively written for Linux. 
 
For those of you not knowing Linux yet, the basic commands will be explained here. We suggest that you perform all steps on your computer as well (if you have Linux installed). Note that some explanations or examples given here were written for the german in-house version of the tutorial, so some details concerning the computers may differ. 

The terminal

The first difference to Windows you will notice is the fact, that the input of commands - to work with files or to start programs - is not done graphically with the mouse clicking symbols, but commands are written into a separate text window, called the terminal. Maybe this way of input as well as the names of some commands (see later) remind you of the old MS-DOS.
No matter whether besides the Netscape window a terminal is already open, please open a new terminal. Therefore, click the terminal symbol on the bottom bar of the screen, it looks like one of those:
 

oder 

The terminal window can be manipulated more or less the same way you know from Windows, e.g. a click on the left one of the top right symbols will iconify the window - a button should then appear on the task bar, normally on top of the screen. Clicking the button recovers the window.
Note: Although actually not necessary, you can work with more than one terminal during the tutorial.
The terminal normally starts with the input prompt, e.g. ws@stan:~ > .
This prompt contains some information: 

 
In front of the @, the initials of the user name are written, telling you which account is used. For example, ws is the account 'Workshop', installed on our net for external users.

Which account appears in a new terminal, depends on the 'owner' of the whole user interface. Should another user than yourself be active in the terminal, it is not necessary to restart the interface - you just register inside the terminal (see later).
 
After the @ you find the name of the computer that you control via the terminal. Usually this is the computer in front of which you are sitting.

Names are given to computers in order to identify them within the network. So it is possible to access remote computers (even if occupied by another person) via the terminal and to run a program there.
 
Next to the colon of the prompt, the actual directory path is given. This is explained in the next paragraph. Finally, after the arrow > the user types in the commands. 

The file system structure

In Linux, like in every operating system, data of any kind are saved in files, which are organized in directories. The complete 'address' of a certain directory within the whole structure is called the path. In Linux, paths are specified like in the web, i.e. from left to right you go from higher to lower directories, which are separated by the slash (/). The complete path name for the home directory of the 'workshop' account is /net/home/ws
 
The home directory of the current user/account has always the same abbreviation, the tilde (~). You find this symbol automatically at the first prompt of a new terminal (see above). 

Two other abbreviations for directories should be mentioned:
 
.refers to the directory you are currently in.

.. refers to the corresponding parent directory.

If . refers to /net/home/ws/projekte/tutorial, then .. refers to /net/home/ws/projekte.

The commands

Now we discuss some practical examples to explain the application of the Linux commands (at least those necessary or helpful for the tutorial tasks. From now on, expressions to be typed by you are written in green (and somewhat bigger), examples for other terminal text/messages are written in red, as before.
We assume that the terminal is not yet yours, but another user is given at the beginning of the prompt. So register first:
>
su - ws 
 
su means 'super user', as such you can change to any (non-protected) account. 

The dash in front of ws changes the current directory to the new home directory, thus the prompt should now look like this on a computer called 'name':
ws@name:~ > 
As you are not yet in the tutorial directory, change to it. It is a sub-directory of/net/home/ws (~).
> cd projekte/tutorial/english
 
cd means 'change directory' and leads the user into the respective target directory of the path given. As you can see, paths do not have to be given with complete names, but only beginning with the first sub-directory of the one you are still in.

The last command has moved you three directories lower, now you are here:
ws@name:~/projekte/tutorial/english > 
This is the directory, where all HTML files and pictures of this tutorial (english version) are found. Files have not yet been mentioned, they are the units where data are actually stored. Now, list the contents of the current directory:
>
ls 
 
ls means 'list' and shows the content of a directory. If a path is given after ls, the content of the specified target directory is listed (but without changing to it).

Sub-directories are usually listed in blue, files in black (sometimes also other colours for executable or non-Linux files). Another feature of files is their extension (which exists in most cases), e.g. index.html for a HTML file. Extensions are quite important for the use of the SHELXTL programs, as you will see in the other tutorial chapters.
If you want to get some more information, type:
ls -lrt
 
The command argument -lrt causes the 'list' function to output not only the file names, but also the file status, size in byte and date of creation / last modification. Additionally, the files are sorted by that date, the ones created or updated last are at the bottom of the list.

~/projekte/tutorial/english contains two sub-directories itself:
user is the directory, in which you can work yourself - to test the Linux commands and to redo the structure determination presented in the tutorial chapters 1 to 5 on your own.
save contains all files belonging to the single determination steps for the tutorial structure - but only to look at them and compare it with the own work. These files cannot be deleted or edited, nor can new files be written, moved or copied into the 'save' directory.
Now move to the 'user' directory and display its content:
> cd user
>
ls
There are only two files, momo-new-unmerged.hkl andmomo.cell in the user directory. Starting with the HKL x-ray data file you can repeat the steps worked out for the main tutorial (1-5). But first, you continue with the Linux crash-course: Now commands that actually change the data structure on the hard disc, will be explained. These tasks are: Copying, moving, renaming and deleting files and the creation of new sub-directories. First, make a copy of the HKL file:
>
cp momo-new-unmerged.hkl test.hkl
 
cp means 'copy'. It copies the file given as first argument...

a) within the same directory with a new name for the copy (the second argument is a new file name) 
b) into another directory keeping the original name (the second argument is a path name) 
c) into another directory with a new name for the copy (the second argument is a path ending with the new file name) 

You just used type a) of the command - as you can check with ls, a new file test.hkl is now in the user directory. Note: Two files in the same directory cannot have the same name.
Now rename the new file without copying:
>
mv test.hkl probe.hkl
 
mv means 'move' and has the following effects on the file given as first argument: 

a) it changes the name (the second argument is a new file name) 
b) it moves the file to another directory keeping the original name (the second argument is a path name) 
c) it combines the movement and renaming (the second argument is a path ending with the new file name)

You just used type a), so test.hkl has got the new name probe.hkl. Next, create a new sub-directory into which probe.hkl shall be copied with its original name:
> mkdir temp
 
mkdir means 'make directory' and creates a new empty sub-directory with the given name in the current directory.

> cp probe.hkl ./temp

This is type b) of the copy command, where another target directory is given. In ~/projekte/tutorial/user/temp a copy of file probe.hkl has been created. Check this with the known commands, if you wish.
Finally, the new file shall be moved from temp back to the parent directory user this is the one where you should still be located.
ws@name:~/projekte/tutorial/user > mv ./temp/probe.hkl .
Here, the abbreviation . for the target directory user has been chosen, because this is the current directory. But should you be for some reason be in the sub-directory temp, you copy the file with the same result by typing:
ws@name:~/projekte/tutorial/user/temp > mv probe.hkl ..
In this case, you use .. as abbreviation for the parent directory.
 
Important: During the last operation the file probe.hkl in directory user has been overwritten by by its copy. In general Linux does not prevent the overwriting of identically named files by the commands 'copy' and 'move', so avoid the use of double names. Files are by default not write-protected and unlike Windows, Linux does not warn the user. ! 

Ending the practical tasks, you should tidy the user directory. Recover its original state by deleting first the file probe.hkl , then the sub-directory temp.
> rm probe.hkl
> rmdir temp
 
rm means 'remove' and deletes specified files.

rmdir means 'remove directory' and deletes specified directories, but only if they are empty.

Note that Linux knows place-holders for certain text patterns. If you wanted, for example, to delete all files with the extension .txt, you would type rm *.txt. The star * is a global place-holder i.e. independent of the text string length. It replaces everything in front of or after a search pattern. Instead, the question mark ? is a specific place-holder, replacing a single text character at a special position, e.g. in rm test-?.txt 

Handling programs

First of all, programs are special files that can be executed by calling their names in the terminal. In Linux, you usually will recognize them by the lack of a file extension (unlike to DOS/Windows, where they end with .exe). The programs that you use in the scope of this tutorial can even be started without being in the current directory. This is due to the fact that the operating system is configurated with search paths by which the names of frequently used programs are recognized and their location automatically found. Note for external tutorial users: Make sure you have the SHELXTL programs installed and familiarize yourself with the setup of your system. Some programs are called by typing their name alone, others in addition need the name of one or more files they work on (obligatory or optionally).
To illustrate this, use the text editor nedit. If you typed in the name 'nedit' alone, the program would be able to start, but with an empty work window. Type
ws@name:~/projekte/tutorial/user > nedit momo-new-unmerged.hkl
instead to open the HKL file on the start of nedit. The HKL content will be displayed at once (and can be edited if wished). As pointed out by the name, only text files and no binary files can be read by text editors. The HKL file will be explained in tutorial chapter one. Nedit is used more or less like the Windows editor 'notepad', but has got many more functions. We recommend it as the text editor of choice for inexperienced Linux users. (With the later versions of SuSe Linux, the equivalent editor kedit is distributed.)
Close the program using the menu 'file'->'close' or the close symbol on the window frame. Perhaps you have noticed that you could not work with the terminal during the use of nedit , because no new prompt has appeared like after normal Linux commands. Programs started normally run in the foreground and block the terminal. It is possible, however, to run programs in the background to enable a free terminal for new commands. Therefore, please type:
> nedit momo-new-unmerged.hkl &
 
The ampersand & causes programs to run in the background. Of course, this is only reasonable for programs that have their own window instead of producing text output in the terminal.

At this point the Linux crash-course ends. In some parts of the tutorial (1-5), Linux commands are also mentioned. In particular if the use of the SHELXTL programs is explained, we always tell how and with which arguments they are started from the terminal.