A Quick Primer on Linux and Shell Scripting

You are assumed to know how to set-up and use a VNC viewer, and have some basic knowledge of Linux or Unix (see e.g. our unix survival guide). The following is just to get you on the way. Click here, for example, for more on shell scripting.

Some Practical Tricks...

Basics of Linux

You probably already know commands such as ls, cd, pwd or mkdir which you usually execute in a command window:

FirstCommands.jpg

See below for some tricks that may be useful when you work with Linux a lot.

Basics of Shell Scripting

If you want to display text on the screen, you can use the "echo" command. If you want to display this text very often (don't ask for the reason), then you can write it in a script.

Open a new file (e.g. using the text editor "nedit"), put "#!/bin/sh" at the top (so the file knows it's a script and how to interpret the following commands), and add the command you would like execute.

Save the file. You have to make the file executable by changing the permissions ("chmod" command).

FirstScript.jpg

This is boring. You want to be more flexible. In many scripts, you want to execute the same command(s) for a number of different subjects. For this, there is the "for" loop:

LoopScript.jpg

Nothing can stop you now!