Getting Started with Linux:
I have made a little series of notes called "Getting Started with Linux and Fortran". You can download them
here (right click on the link and select 'save link as'):
Part 1
Part 2
Part 3
You can also peruse this beginners guide written
by Keith Hsuan.
Note that these were written for the Red Hat distribution of linux. this is
slightly different to the Ubuntu distribution that you will be using. The
basics are the same. If you get frustrated with somethig not working, as
your tutor!
Here are the basic steps to getting up & running with Linux at Uni:
If the computer is in Windows mode, reboot it and choose Linux from the menu that comes up.
Put in your password etc.
Open a TERMINAL (click on the picture of a computer screen on the control panel - or right-click and select
TERMINAL from menu).
Once you have a terminal you can type in commands to run programs, list the directory contents, etc.
Open up a text editor - eg. type nedit & in the Terminal (the '&' means you can still use the terminal for
other things).
You can also run a web browser like this - eg. type netscape&
You can now start writing a program! (see next section).
Password problems?
If you're having problems logging in to Linux, try changing your password. It changes your password on all systems to be the same. Give it 10
minutes to update.
If that doesn't work, you'll have to try the ITS Helpdesk.
Writing a Fortran Program
I've made a couple of sample programs for beginners: 'Hello World' (html or download the fortran file) and 'Plotter' (for
Q10, sheet 1 data -- html or fortran).
In the 3rd computer tutorial we will make another simple program - a calculator (fortran and html).
Dr Rosemary Mardling's Fortran Primer (pdf - right click to save (*1st page is blank*) is also
very handy.
Gareth's page has a basic plotting routine
written in FORTAN.
Note: Always save your program with a .f at the end of the name.
Compiling and Running a Fortran Program:
Write your program in a text editor (eg Nedit). Don't forget to put an END statement at the end.
Compile the program: f77 -o program.exe program.f
If you're using PgPlot then compile with: f77 -lpgplot -o program.exe program.f -L/usr/X11R6/lib
-lX11
For more info on PgPlot see their webpage.
If there's a mistake in the program, the compiler (f77) will tell you. Fix the mistake and try again :)
Run your program: ./program.run (the ./ tells Linux where the program is).
Printing your Masterpiece:
Note: This may not work anymore, try the method in Part 2 of my Linux notes.
To get a hardcopy of your PgPlot graph, type /PS instead of /XS when you run PgPlot. This will output a .ps file you can print.
Before printing, run NSETPRINT to set up the default printer. Then just type lpr myfile.ps.
To print out your Fortran program, type a2ps myprogram.f.
|