Lab 1 - Unix & uploading a Web Page
Goals: Prepare the students for working on lab exercises by introducing them to the Unix operating system as well as how to upload a Web page to a Sparky Web account.
Introduction
An Operating System is a software program that runs on a computer and manages all the other programs running, as well as all of the resources of the computer. Popular Operating Systems include Microsoft's Windows Vista, Apple's Mac OS X (Leopard), and Red Hat's Linux.
Today we will look at Unix, one of the grand daddies of all Operating Systems, developed originally at AT&T's Bell Labs in 1970 and still in widespread use today.
The Unix version we will be using is a command-based system. Meaning, you tell the computer what to do by typing commands, rather than a GUI system, where one uses the mouse to control the computer. Many new users find this less user-friendly. Many commands have to be remembered and typed properly in a specific format. Experienced Unix users love it because of its elegence and because it can make performing more complicated tasks easier than they would be in existing GUI-based systems.
In addition, we will be using a GUI-based FTP program, which will allow us to easily upload files from a personal computer to a Web account.
NOTE: You must have a WebMail account and have requested Web space on your Sparky account. The Instructional Computing site lists those students who have Web space allocated. Just check under your name to make sure you can do this lab.
SSH Client: You should use SSH Secure Shell Client to log into you Sparky account. Again, Sparky uses the Unix operating system. With the SSH Client you can give commands to the operating system to do things like make directories, make files, move files, and run programs. We will really only use the client program once this semester, during this lab, to setup the directories for our Web account. If you ever take programming courses in the Computer Science department, however, you will likely be required to do development on a Unix system.
SSH FTP: In addition, you should use the Secure File Transfer Client (FTP) this semester to upload files to your Web account. This program provides a user friendly GUI (Graphical User Interface) to interact with Unix and allow you to move files from your personal computer to your Web account. We will use this program all semester long.
Instructions
Go to Instructional Computing's instructions page for setting up your Web account. Follow the instructions on this page such that you:
- Login to Sparky/Unix - You should use a secure program like SSH to do so.
- Access your Web page - make sure you know your URL
- Create a symbolic link - This will allow you to use the FTP program.
- Create an index page - Note, for this step, I have provided you an index.html page and an image for you to place on your Web site as your index page. So, what you should do now is download these two files to your computer and then upload them into your www directory in your Web account. If you already have an index page that you wish to keep, then simply rename this one before uploading.
- Upload files to your account using the SSH FTP program - You will use this program all semester to post work to your Web account, so learn it ASAP.
Email your URL to the TA: After completing each Lab assignment, you should post your work to your Web page. To prove that you have created and posted your Web page in this lab, use your WebMail account to email your URL to the TA for verification.
NOTE: For those of you who are curious about the Unix operating system, it is an ancestor of Linux, and is widely used by many servers and software developers to this day. Learning to use it at first is a matter of learning commands and later writing scripts and programs to harness its true power. Below I have listed many useful commands for manipulating files and directories using Unix. Try using these commands and see what results you get.
SUMMARY OF USEFUL UNIX COMMANDS
| Unix Command | Function | Example Usage |
| . | Refers to the present working directory. | See the cp example |
| .. | Refers to the parent directory of the present working directory. | See the cp example |
| ~ | Refers to the home directory of your account. | See the ls example |
| * | A wildcard reference, it means everything in a directory. | See the chmod example |
| cd | Traverse through existing directories by changing the present working directory. |
Change to the hw1 directory: cd hw1 |
| chmod 700 | Sets the file permissions for a file or files (first argument) such that no one but the account owner may read, write or, execute the given file(s). |
Sets proper permissions for all .java files in the lab0 directory: chmod 700 lab0/*.java |
| chmod -R 700 | Sets the file permissions for a directory or directories and its contents (first argument) such that no one but the account owner may read, write or, execute (traverse through) the given directory or directories. |
Sets proper permissions for the complete contents of the given account: chmod -R 700 ~/* |
| cp | Copies a file or files (first argument) from one location to another (second argument). |
To copy Echo.java from the parent directory into the current directory: cp ../Echo.java . |
| cp -R | Copies a directory or directories (first argument) from one location to another (second argument). |
To copy the hw1 directory and all its contents into the parent directory: cp -R hw1 .. |
| java | Run a compiled java program. |
To execute a program called Driver: java Driver |
| javac | Compile a java file or files (arguments). |
To compile all .java files in the present working directory: javac *.java |
| ls | Lists the contents of a directory (first and only argument). |
To list the contents of your home directory: ls ~ |
| ls -l | Lists the contents of a directory (first and only argument) in a long output format, which gives complete information on all contents. |
To list the contents of your home directory in long form: ls -l ~ |
| man | The Unix manual, it opens a help screen on a command topic (first and only argument). |
To get info on how to use the cp command: man cp |
| mkdir | Makes a directory using the name(s) of the argument(s). |
To create a directory named lab99: mkdir lab99 |
| mv | Moves a file or files (first argument) from one location to another (second argument). |
To move all .java files from the present working directory to the home directory: mv *.java ~ |
| mv -R | Moves a directory or directories (first argument) from one location to another (second argument). |
To move all directories starting with the letters "lab" files from the present working directory to the home directory: mv -R lab* ~ |
| passwd | Allows the user to change his/her login password. | passwd |
| pwd | Displays the full path to the present working directory. | pwd |
| quota -v | Displays the disk quota and usage for the user's account. | quota -v |
| rm |
Removesa file or files (first argument) from one location to another (second argument). WARNING: Be careful using rm, it deletes files! |
Remove all .class files from the present working directory: rm *.class |
| rm -R |
Removes a directory or directories (first argument) from one location to another (second argument). WARNING: Be extremely careful using rm -R, it deletes entire directories! |
Delete your test directory and all its contents: rm -R test |
Web page created and maintained
by Richard McKenna