MCSR Seminar
for
Delta State University
November 1, 2006
1.
Getting
Started
o
Logging on to
the system
i.
Start
the secure shell client:
Start->Programs->SSH Secure Shell->Secure Shell Client
ii.
Connect
to willow:
From the secure shell window, click Quick Connect.
Then, from the Connect to Remote Host pop-up window, enter:
Hostname: willow.olemiss.edu
User Name: disXXXYY (XXX is 314 or 210, YY is 01, 02,
03, etc.)
and click Connect.
iii.
Enter your
password in the popup window. It will make you change the password the first
time you login.
passwd:
Changing password for dis21025
Enter existing login password: Enter
the same old password here
New Password: Enter a new password here. It must contain at least 2 non-alphabetics
Re-enter new Password: Reenter
password here
passwd:
password successfully changed for dis21025
At this point, you will be automatically logged off. Log back in by
hitting Quick Connect and entering your new password when prompted.
2.
Listing
files and creating directories:
pwd (Print the name of your
working directory)
ls (List the
files in your working directory…it should be empty)
mkdir workshop
(Make a new subdirectory under
your home dir called workshop)
ls (List the
files in your working directory…there should be one)
cd workshop (Change
directories to your workshop directory)
pwd (Print the name of your
working directory…what is it now?)
ls (List the
files in your working directory…there should be none)
3.
Copy example
files to your workshop directory. (The first time you login
only.)
At the willow command prompt, type:
pwd (Confirm that you are in your workshop directory)
/tmp/godsu (Executes
Unix script that copies three files to your workshop dir)
ls (Confirm
that the three files are there: hello.cpp,
program1.cpp, ouput.
4. Examine the hello.cpp (C++)
file, using the Unix cat, and pico utilities:
cat hello.cpp (to print the contents of
the C file to standard output)
pico hello.cpp (to
edit the file…other editors available are vi
and emacs.
(pico is a file editor. Scroll up and down with arrow
keys. To quit without saving, hold down the Ctrl key, and hit the capitol X
key, and respond with No to destroy any changes you accidentally made. Use
Ctrl-C (hold down the Ctrl key then press the C key) to see what line number
you are on in the pico editor. To save, hold down the
Ctrl key, and hit the capitol O key (Write Out), then enter to confirm the file
name.
5.
After exiting the
pico editor, compile the hello.cpp
file using the GNU C++ compiler:
g++ hello.cpp (to compile the program with the
C++ compiler)
ls –l (to
list the contents of the current directory, in long format…see a.out?)
a.out (to execute the
file “a.out”, the executable created from
compiling hello.cpp)
6.
More about files
and directories.
pwd (confirm that you are in workshop directory /users/disXXYYY/workshop)
ls –a (list ALL files
in current directory, including hidden ones…what new hidden file?)
cp .ohell.cpp ohell.cpp (to copy the hidden file out
into the open)
ls –al (to
confirm that it got copied)
mv ohell.cpp ohell.cpp (to move the hidden file to the unhidden,
rather than copying)
ls –al (to
confirm that it is no longer in your home directory)
7.
Debugging a C
program:
pwd (you should be
back in directory /users/disXXYYY/workshop)
rm a.out (remove the old
executable file)
cat ohell.cpp (looks kind of like hello.cpp)
g++ ohell.cpp (try to compile the new C
program…what is wrong?)
pico ohell.cpp (go to suspect line number and
fix the problem)
g++ ohell.cpp (iteratively debug until this
compiles cleanly)
a.out (to execute the
program)
8.
Redirecting
Standard Output and Input and using Pipes
a.out > hello.out (execute a.out
and put the output in file “hello.out”)
more hello.out (view the contents of hello.out, page at a time)
date (Unix command to print the
current date and time)
date > date.out (Redirect the output of “date” to
a file)
cat date.out (Look at the contents of
date.out)
a.out | more (Redirect
the output of a.out to be the input to “more”)
wc hello.cpp (count the number of
characters, words, and lines in hello.cpp)
wc –l hello.cpp (count the number of lines only,
in hello.cpp)
who (see who is
currently logged in)
more program1.cpp (Look at a more involved C++ program)
more input (Look at the input file to be used by prgram1)
g++ program1.cpp –o program1.exe (compile the program and
explicitly name the executable it creates)
program1.exe < input (run program1, redirecting the input to come
from the file input rather than the terminal)
program1.exe < input > output (run program 1, getting input
from file input and putting output in file output)
cat output (see the contents of the output file)
9.
Using the Unix
man pages to learn all about a command:
man ls (look for the –l and
–a options of the ls command)
man wc (look to see how to
count just the number of words in a file)
man cc (learn all about the cc compiler)
10.
Creating an HTML
page on willow.
cd (change to
your home directory on willow)
mkdir public_html (make a directory called public_html to put your html files in)
cd public_html (cd to
the public_html directory)
pico test.html (create an html file with just this text:
<html><body>This
is a test</body></html>
Ctrl O from pico To
Save (write Out) the file (enter Y or Yes when prompted)
11.
Viewing your html
file from a web browser:
Bring up a Web Browser
Browse to: http://willow.olemiss.edu/~disXXXYY/test.html
(where disXXXYY is your account name)
UNIX Help for Users
http://www.mcsr.olemiss.edu/unixhelp/
Secure Shell at UM/MCSR
http://www.mcsr.olemiss.edu/computing/ssh2.html
Downloading Secure Shell: http://www.olemiss.edu/helpdesk/resources.html#software
This Seminar: http://www.mcsr.olemiss.edu/educationsubpage.php?pagename=class.inc
C++ on willow: http://www.mcsr.olemiss.edu/appssubpage.php?pagename=cwillow.inc