Unix

Topics: bbs, CC, cc, cd, cp, f90, .forward, login, logout, ls, mkdir, pico, pine, rm, vi

bbs
The bbs (Bulletin Board System) command will take you into pine with a read-only folder that can be "posted" to by sending mail to bbs@mode.lanl.k12.nm.us or if you are on mode, just pine bbs will work. You can interact with other Challenge participants, but remember that everyone sees what is posted to the bbs.

CC
The CC command will invoke the C++ compiler to compile a C++ program. The -o option will name the output file differently from the default name of a.out.
Example: CC -o project2 project2.c

cc
The cc command will invoke the C compiler to compile a C program. The -o option will name the output file differently from the default name of a.out.
Example: cc -o project project.c

cd
The cd command will change to another directory. If no directory is specified, cd will return to the home directory. When a directory is specified without a path, it is assumed to be a subdirectory of the current directory.
Example: cd public_html
If the directory is not a subdirectory, a full path must be specified.
Example: cd /usr/local/scc/examples

cp
The cp command will copy a file from one location to another.
Example: cp /usr/local/scc/examples/bacteria.f bacteria.f
or
cp /usr/local/scc/examples/bacteria.f .
where . means the current directory.

f90
The f90 command currently invokes the GNU F77 compiler on mode, but will invoke the SGI Fortran 90 compiler on pi, to compile a Fortran program. The -o option will name the output file differently from the default name of a.out.
Example: f90 -o solveit solveit.f

.forward
If you regularly read mail on a machine other than mode.lanl.k12.nm.us, please create a file called .forward that contains your email address on the other machine. Enter: pico .forward then put in your email address, like Joe-student@aol.com and save the file (^O ^X) and then TEST IT by sending mail to your mode account and see if that mail shows up at your other machine, if not look at your .forward file again.

login
Challenge account name begin with ch and are followed by the team number and the person's initials, ie ch001abc. For dialin access through the Technet phone numbers, use ch001abc@chall so that the terminal server knows to validate your password with mode.

logout
Don't forget to logout when you are finished using mode.lanl.k12.nm.us so that others will not bother your files and you will not use any system resources.
Example: logout

ls
The ls command will list the contents of the current directory. There are many options to the ls command which are discussed in the man pages (enter: man ls).
Example: ls /usr/local/scc/examples

mkdir
The mkdir command will make a directory. This is a useful way to organize information. Use the rmdir command to remove an empty directory.
Example: mkdir reports research code

pico
pico is a very simple editor. It is the default editor for creating mail messages when using the pine mailer. It is always in "insert mode" and shows the possible control commands on the bottom of the screen. The arrow keys can be used to position the cursor and characters can be deleted with either the delete key or the backspace key.
Example: pico index.html

pine
pine is an electronic mail program that is very friendly and easy to use. It uses the PIne COmposer (see pico above) to create new messages. Challenge email addresses are in the form of login_name@mode.lanl.k12.nm.us and mail should be read and sent from mode as opposed to pi. There is help on each screen of pine and possible commands are listed on the menu or across the bottom of the screen.

rm
The rm command will remove (or delete) a file that is no longer needed. Once a file has been removed, it can not be recovered so you might want to use the -i option which will ask for confirmation before the removal take place.
Example: rm -i a.out

vi
vi is the "standard" Unix editor found on every Unix machine. It is more powerful than pico, but is more complicated to learn. The best way to learn about vi is to read about it in a Unix textbook and try using it.
Example: vi solveit.f

For more information about Unix, look at the Challenge Help page that is available online.

Unix Lab Exercises

  1. Logon to mode (mode.lanl.k12.nm.us)
  2. At the mode:~>   prompt, create a directory called examples and change to it
    1. mkdir examples
    2. cd examples
  3. Copy the files bacteria.f, sample.c and sample.f from the directory /usr/local/scc/examples into your examples directory with the following commands
    1. cp /usr/local/scc/examples/bacteria.f bacteria.f
    2. cp /usr/local/scc/examples/sample.c sample.c
    3. cp /usr/local/scc/examples/sample.f sample.f
  4. List the files you have with ls
  5. Look at the files you have with cat or more
    1. cat bacteria.f
    2. cat sample.c
    3. more sample.f
  6. Compile the C++ program with CC sample.c (those are 2 capital "C"s) and run it by entering a.out
  7. Connect to the pi machine (pi.lanl.k12.nm.us) by entering pi
  8. Change to the examples directory with cd examples
  9. Compile the bacteria program with f90 bacteria.f -o bacteria.x then run it by entering bacteria.x
  10. Compile and run the sample.f program.
  11. Remove the a.out file created from mode with rm a.out
  12. Logout of pi to get back to mode with logout
  13. Check the Bulletin Board by entering bbs
  14. Change to your public_html directory by returning to your home directory with cd then cd public_html
  15. Edit your web page pico index.html and replace the generic information with your information.
  16. If you regularly read mail on an account other than your Challenge account, please create a file called .forward that contains your other email address. Make sure you test it.
  17. One of your team members needs to edit the abstract9900.shtml file that is located in everyones directory with your team's information and once that is complete and spell checked, submit it to the Challenge staff by entering submit abstract9900.shtml
  18. Using pine, send mail to your team members to establish a time this week to discuss what you learned at Glorieta.
  19. Use the man command to learn about some of the options to the ls command, enter man ls
  20. Logout of mode logout

September 1999
Document URL--http://www.challenge.nm.org/Archive/99-00/Glorieta/unix.html

New Mexico High School Supercomputing Challenge
Coordinated by Los Alamos National Laboratory and New Mexico Technet
Questions? e-mail: consult