Computer Access and Use Information for Java Students, including Unix and hills
Everyone who is registered in a computer science class
automatically gets two computer accounts: one on
the ACRC's Windows network, and one on "hills",
which is a UNIX system. By registering in this class, you also get a third account,
on the Linux network in our classroom.
hills account info
Your hills account is on an HP-UNIX system, and gives you
access to e-mail
through the "pine" program, text file editing through
the "pico" program, and Java
compiling through the "javac" program,
plus other standard software. Hills may be accessed from any
computer that has dial-up or Internet access, including the
computers in the ACRC. To access hills, use
any telnet or terminal emulation program, such as SSH Client or PuTTY.
Your hills login name is the same as your CCSFmail account user name. To find this user
name, Login to Web4, go to the "Student Services & Financial Aid" tab,
and scroll down to the "Student CCSFmail" link near the bottom of the page. Then click on "CCSFmail info".
If you need help determining your login
name, ask an ACRC staff member. If you've
never logged onto hills before, your initial password for hills
is your birthday, written like: jan0380 if you were born on January 3, 1980. You will
be forced to change this password the first time you login,
using this password as your
"old password", and a new one of your choice for
future use. If you've logged onto hills before, your password
is the same as it was last time you logged in. Ask the ACRC
staff for help if you don't remember your password.
To connect to hills, use a
terminal emulation program such as SSH Client or PuTTY.
From a Mac or Linux computer, you can open a terminal window and type:
ssh uname@hills.ccsf.edu
(Put your hills username in place of "uname" above.)
A simple Telnet program can be run from most Windows
computers by selecting "Run" from
the Start Menu and typing "telnet hills.ccsf.edu"
If you have Windows Vista, you may have to turn it
on with this procedure:
Start -> Control Panel -> (on the left side) Turn windows features on or off
-> check Telnet Client, Telnet Server, and TFTP Client -> Click OK
-> Might need a restart
If you have Windows 7:
Just once: Go to Control Panel (right-side of Windows Menu) -> View By Small Icons
(in top right corner) -> Programs and Features -> Turn Windows Features
On or Off -> Telnet Client (You might need an
administrator to login for you to allow you to make this change.)
Each time you want to login: Open Windows Menu and select All Programs -> Accessories
-> Command Prompt. At the command prompt, type:
telnet hills.ccsf.edu
Then enter your username and password, and continue on from there.
When logging in to hills, you should then see something similar to the
following displayed on your screen:
HP-UX hills B.11.00 U 9000/800 (to)
login: cpersiko
Enter your own login name here.
Password:Enter your password here. Nothing will be
displayed, for security.
Last successful login for cpersiko: Sun Nov 7 18:12:13 PST8PDT 2004 on pts/7
Last unsuccessful login for cpersiko: Wed Jun 30 09:24:27 PST8PDT 2004
Please wait...checking for disk quotas
bash-2.04$
The last line above is your unix prompt, which means unix is ready for you to type a command. (See UNIX Basics below)
Your Linux account is used when you sit down at a computer in our classroom (Batmale 413) or at one of the
Linux computers in the ACRC (on the right-side wall past the counter). Your initial login and password on this Linux
account are the same as on hills, but remember they are different accounts. So if you change the password on
one account, it doesn't change the other. Linux behaves just like Unix at the command line, so pretty much
everything else you read below regarding Unix also applies to Linux. One big difference between our Linux
machines and the hills Unix server is that the Linux machines have a full graphical user interface (GUI), and
can run programs such as Firefox, OpenOffice, etc. The hills system has only a text, command-line interface,
as described below.
Your ACRC account is used only to log into PC's in the Academic Computing Resource Center (ACRC) computer lab
in Batmale 301. Other computer labs don't require special logins.
You can access Firefox and Telnet/SSH programs such as SSH Client from
these computers, as well as other standard software. There are also tutors available in the ACRC. They can
help you with your homework. For extra help getting started with hills and the computers in the ACRC, go to
a lab orientation in the first couple weeks of the semester.
The login to your ACRC Windows account is the same as the
initial login to your Hills HP Unix account
described above. Your initial password is your birthdate in
the same format as it was for hills, and this password is reset
at the beginning of each semester, so your old password is no
longer valid if you've logged in to the ACRC network in previous semesters.
If this is your first login to your Windows account,
or if your password has expired (approximately every 45
days), there is a reminder to change your password, and you should do so.
To print a file from hills, use the lp command at the UNIX
prompt. For example, to print the file
called "myresults" to the printer called "iclpr1", use the
following command:
lp -d iclpr1 myresults
The file will be printed in the ACRC lab on the "iclpr1" printer. There is also a printer called "iclpr2"
available for your use. If you want to print the file "myresults"
to your personal printer, use this command:
lpansi myresults
It doesn't always work, but if it does, the file will be printed on
your computer's default printer.
To print from Windows, you must pay per page, using a Vendamatic printing card like in the
library.
Make sure to log off when you are finished with the computer.
To log out of Windows, go to the
Start menu at the bottom-left-side of the screen and select "Log Off"
When turning in a programming assignment, the entire
source code listing of your program must be included, along with sample test results that show the full
range of your program's behavior. You can use any Java compiler/IDE to do this. It can
be done using copy and paste, or other tools. Instead of using UNIX and javac, you can install your own Java
compiler/IDE, such as those listed on my links page.
If you do use hills (UNIX) as described in this document, the best way is to save it as a
script. To do so, simply type "script homeworkScript" at the UNIX
prompt. You should see the following message in response:
"Script started, file is homeworkScript". This
means that everything displayed on the UNIX screen from now on
will be saved in a text file called
homeworkScript. When you are finished testing your program and you
want to stop adding to the homeworkScript file,
type "exit", and you should see the following: "Script done,
file is homeworkScript" The file "homeworkScript" can
then be printed, or submitted for your homework.
Warning: Make sure you always exit your script when you
are done testing your file. If you don't
exit the script, your script file will keep growing and
growing. Also, never run pico or pine when a
script is running. The screens displayed by these programs
will fill your script file with junk.
To get help or ask questions, use the class's Insight discussion board to ask your classmates for
help. (I will read and respond to discussion board postings too.)
Please don't post more than a couple lines of Java code to the Insight discussion forums, as other students
may copy your work. If you need to show a large part of your code to ask your question, please
e-mail your question to me directly. If you are e-mailing me your question, please include as much information
as possible: send me your full program and the exact results it produces (error messages or other output).
When sending me e-mail, do not use any attachments. Put
everything into the text of the e-mail message.
This can be done using copy and paste, but the best way
to do it on hills is to insert a file into your e-mail message.
To insert a file, hit Ctrl-R when
you are typing the e-mail and your cursor is on the place you
want to insert the file. You will be
prompted for the filename to insert. To include your program's
sample output, first save it as a
script, as explained above.
The Linux lab classroom where our class meets (Batmale 413) will be open from 11-12 Tue/Thur, staffed by
a work-study student who has taken this class before, and can help you with your homework.
There are also tutors available in the ACRC in Batmale 301. They can help you with your homework, too.
The ACRC has put some good UNIX-related tips online
One common mistake with hills UNIX is when people use the mouse. On hills, we
are using UNIX with a text-only interface,
so your mouse does nothing to interact with hills. When you're
using hills, forget about the mouse.
Another common mistake is that people don't know UNIX is case-
sensitive. So file and program names must
always be in the correct (upper or lower) case.
When you log in to hills using your own username, you will
automatically be placed in your own directory on
hills. So you can save any files you wish in that directory or
any subdirectories you create. All the
files you create will be there for you next time you login.
Here is a list of basic commands you should know, all of which you type
at the main UNIX prompt:
- ls
- list files in current directory. Use ls -a to list all files (including hidden ones)
- rm myfile
- remove (delete) the file specified (replace myfile
with your file's name)
- cp oldfile newfile
- copy file: above will make a new copy of oldfile,
calling it newfile
- mv oldfile newfile
- move file: above will change the name of oldfile to
newfile
- mkdir newdir
- make directory: above will make a new directory
called newdir
- cd newdir
- change directory: above will make newdir the new
working (current) directory
- cat myfile
- concatenate (display): above will print the contents
of myfile to the screen
- more myfile
- same as cat, except it shows only one page at a
time. Hit space to see next page, or "q" to
stop display.
- script myscript
- create a script file called "myscript" (use any name you wish).
Script file will contain all future screen output. Don't forget to type "exit" to stop scripting! More
details are above under "Homework submission guidelines".
- exit
- exit, or logout, from hills. Or if you're in the
midst of a saving your output to a script,
this will stop the scripting.
- Ctrl-C
- To terminate a program - if you need to stop a program and get back to your unix prompt
(maybe your program is in an infinite loop or something) - type Ctrl-C (Control and 'c'
together). If you just close your terminal emulator without stopping your program or logging out, the
program will continue to run indefinitely, and you won't be able to delete that program file!
- man xxx
- manual page: UNIX online help: above will tell you
more about xxx. So to learn more about ls,
type "man ls"
- quota -v
- Used to find out how close you are to your quota and maximum limit of storage space on hills.
There are three main programs you'll use on hills: pico
for text file
editing (including writing programs), pine for e-mail,
and javac to compile your Java programs.
Following are some basic directions on how to use these programs:
pico (text editor)
To run pico to create a new file, simply type "pico" at the
UNIX prompt. To use pico to edit an existing
file (or create a new one) type "pico filename" where filename
is replaced by whatever file you want to
edit. To save your file in pico, type Ctrl-o (for write Out),
and to exit, type Ctrl-x (it will prompt you
to save if you've made changes). The is a limited menu of
commands at the bottom of the pico screen, with
the control key represented by ^. To insert a file that you've
saved on hills into the document you're
currently editing, type Ctrl-R.
pine (e-mail program)
To run pine, simply type "pine" at the UNIX prompt. Like pico,
it has a small menu of options at the
bottom of each screen. When you are finished using pine, hit
"q" to quit.
Your e-mail address at hills is simply your login name
followed by "@hills.ccsf.edu".
You can also access your hills e-mail from a web browser by going to:
http://hills.ccsf.edu/mail
javac (Java compiler)
Once you've used pico to write your Java program, use javac to
compile it. The filename for your program
must end in ".java" so that javac knows it is a java program.
If your program didn't compile
correctly, you'll get errors or warnings telling you what's
wrong. Otherwise, javac should have created
a class file for each of your classes, with the name of that
class followed by ".class". So if the file
"prog1.java" defines the class "prog1", then you compile the
program by typing: "javac prog1.java". If
you simply get another prompt, with no message, it compiled
successfully. The file "prog1.class" should
now be in your directory. To test your program, type "java
prog1" at the prompt. To compile and run
a java program on your computer, you follow the above directions,
starting from a command prompt.
Logging Out
When you are done using any computer system, you should always
log out. To log out of hills, type "exit"
at the command prompt. To log out of the Windows network, go to
the Start menu and select "Log Off".
Summary: Step-by-Step Instructions for Doing Homework
You may use any text editor and any java compiler to write and run your program; just make sure you turn in
your source code and sample output, by saving them in a text file and uploading it into Insight. Here are
some step-by-step instructions for doing all this using CCSF resources that are available from anywhere:
- Sit at a computer that is connected to the Internet (dial-up connection is okay). If
personal account login is necessary, see "ACRC account info" above.
- If you are using Linux, you can skip ahead to step #4. Otherwise: Run a terminal
emulation program such as SSH Client, PuTTY, or Telnet.
- Connect and Login to hills.ccsf.edu
- Use a text editor to write your java program. For example, to create a program called "HelloWorld"
type the following at your unix prompt: pico HelloWorld.java and then in the pico window type the
java code for your program, such as this one. When you are
finished writing your program, save it and exit pico by typing Ctrl-x followed by y to save
and Enter to confirm the filename. (On Linux, go to the "Applications" menu
->
Accessories -> Text Editor)
- Compile your program using javac. Continuing with the HelloWorld example, type the following at your
unix prompt: javac HelloWorld.java
If you just get another unix prompt, then your program
compiled successfully. If you get any error messages, use pico to fix the problems in your java code and
compile again.
- Run your program using java. For this example that's: java HelloWorld (if that doesn't work,
try
./java HelloWorld )
- Once your program works and you're ready to turn it in, it's time to save its source code and output
in a file. Start this by typing script helloScript.txt at the unix prompt.
- Now use "cat" to display your file on the screen (and in the script file): cat HelloWorld.java
- Run your program again: java HelloWorld
Make sure to show a variety of test-cases to
demonstrate your program's behavior (by running it as many times as necessary).
- Terminate the script by typing: exit
- You should turn in this script file (named "helloScript.txt"). If you're using Linux, you can skip
ahead to step #15. Otherwise, you'll need to transfer this file
to your computer. You can do this using an FTP program, or by e-mailing it to yourself using "pine".
FTP is probably simpler, so those instructions follow:
- Run an FTP (File Transfer) program on your computer. You may have one available as part of SSH or
other software, or
you can download a free FTP program
here. Use the FTP program to connect to hills.ccsf.edu, and
type in your username and password.
- Since you're transferring a text file, you should set the transfer mode to ASCII text (this
will be done automatically if the filename you're transferring ends with ".txt".
- On one side of the FTP program under "Remote Site" you should see your files on hills,
including "helloScript.txt" (you may need to change directories). Use the other side, "Local System" to
navigate to the directory you want to put your typescript file into, then drag the helloScript.txt
file into the directory.
- Now use your web browser to access
http://insight.ccsf.edu and
log in to this course in Insight. Click on Assignments at top-left and select the assignment you
want to turn in. At the bottom of the page for the assignment, click on the Browse button to select
your file from your hard drive ("helloScript.txt" that you just transferred using FTP).
- Click on the Upload this file button to submit your homework. You should see a confirmation page
saying, "File uploaded successfully"
- Don't forget to log out! In your terminal emulator window, log out of your unix account by typing
exit. In your FTP program, to disconnect click the Exit button or close the program. And
of course log out of Insight by clicking InsightHome on the top left, then clicking Logout at
the top-right of the Insight home page.
More Information
For more information on many of these topics, see my Links page
at
http://fog.ccsf.edu/~cpersiko/links.html
Return to my main page