The host name of our UNIX server is mode.lanl.k12.nm.us
Use ssh (putty, or ttssh) on your Windows laptops and connected to mode.
(you'll need your username and password to do this).Once you're logged in, you should see a shell prompt that looks like this:
mode~>
See section 2.4.6 in your UNIX book (p 27).
1. Writing (editing) a program.
You can use whatever you want, but if you don't know any other editors, we
recommend using 'pico'.To edit a file, at the command line run:
mode~> pico {FILENAME}
Where {FILENAME} is the name of the file you want to edit.
If you don't have a file you want to edit (in other words you
want to create a new file) you can just run:
mode~> picoTo quit and save your file in pico, type ctrl-x.
To just save out your file (without quitting), type ctrl-o.
2. Compiling your code.After writing code such as C or C++ you need to translate your code
into machine code. You do this by compiling the code.We're using the GNU C++ compiler called 'g++'.
To compile your code run:mode~> g++ {CODE FILENAME} -o {EXECUTABLE NAME}
Where {CODE FILENAME} is the name of the file that contains the
code, and {EXECUTABLE NAME} is the name of the program you
want.'g++' is the actual command.
'-o' is an option
{CODE FILENAME} and {EXECUTABLE NAME} are arguments.
See page 37, section 3.2.2 of your UNIX book for more information.
At this point, if you have any errors, you need to go back and fix
them by editing your program (step 1). After fixing any errors
you need to recompile your code (step 2).3. Running your executable code.
Once you have executable code, you can run it by typing the
name of the executable you created - this is the same as {EXECUTABLE NAME}
in the example above.So if you ran as statement like this:
mode~> g++ myCode.C -o myProgram.X
To run my program, you'd run:mode~> myProgram.X
At this point, if your program does not do what you want it to do,
go back to step 1 and modify your code. After modifying your code,
you'll need to compile these changes in, by doing step 2. After
recompiling your modified code, you'll want to run the new
program by doing step 3.