Shells and Commands
AFS is the system that we will be using to hand in our projects. The Mac and Unix clusters have a really nice feature where they automatically log you onto your Andrew space when you sign on. If you are on a home computer or in a PC cluster you need to log on to a CMU server with a file transfer program or a secure shell (like NifftyTelenet or SSH). You can connect using a host such as unix.andrew.cmu.edu or sun.andrew.cmu.edu
Once you are into your Andrew space you need to pull up a shell that is also signed into the CMU network. There are several commands that you should become familiar with... "ls" "ls -l" "pwd" "cd" "cp" "mkdir" and "man" (followed by Enter). The first two commands (ls and ls -l) do very similar jobs. They both list the items that are present in the directory you are currently "in".
But how do you know which directory the shell is currently working from? That brings me to "pwd" (which stands for "present workign directory") type this command and the shell will print out the path name of the file or directory it is working in.
"cd" means "change directory" you can type the whole path name to the directory you want to go to (such as /afs/andrew/course/15/100-kesden). You can also sart from your pwd and build the path name from there (say my pwd is /afs/andrew/course I can get to the 15-100 space by typing "cd 15/100-kesden"). Note the shorthand for your home is "~". Try typing "cd ~" and then "pwd" to see where that comman will take you. You should also look at the folders in "~" (remember, you can use the "ls" command to do this) as you now have a very quick way to write the begining of their path names. If you ever want to go back one directory, but don't want to type it's path name agin, there's a command that tells the shell to back up one level. Try "cd .." you should end up one folder back from your path name.
So "cp" means copy. The computer looks at this command and asks copy what? to where? So when using cp use the form "cp pathNameOfFileToCopy pathNameOfDirectoryToCopyTo". There is another shorthand that you should be aware of "." means to the shell "here" so if I typed "cp ~/Desktop/*.java ." That means copy *.java to my pwd. So what does *.java do. It's a nice way to shorten your typing the shell looks in the directory it's copying from and copies all files ending in .java to the copy location. So if you want to copy three java classes this command will copy them all (assuming they are all in the same folder)
The deal with "mkdir"...It stands for "make directory". You can either type just the name of the directory you want to create and the shell will make a folder in your pwd of that name. If you want to make a folder in a space other than your pwd you need to type mkdir and then the path name of the new directory. in this last case only the last file of the path cannot exist (otherwise the shell will be unable to make the directory).
"man" is a useful command to know. If you ever forget what a command does type "man command" and the shell will pull up the specifics of what that command can do and what parameters it needs inorder to work. Keep this command in mind, it is the healall for a forgetful memory.
So now that you know the general commands used to work in a shell. Let's use them to hand in your first project.
You need to pull up a shell, locate your files to be submitted, make a directory in the lab handin folder, and copy your files to this new directory. Let's take a look at how you would submit GroceryItem.java and GroceryItemTester.java that are on the Desktop of a Mac cluster computer.cd ~/Dektop ls GroceryItem.java GroceryItemTester.java cd /afs/andrew/course/15/100-kesden/handin/labnumber/ mkdir andrewID cd andrewID cp ~/Dektop/*.java . ls -l rights AndrewIDOfCreator fileSize DateModified GroceryItem.java rights AndrewIDOfCreator fileSize DateModified GroceryItemTester.java
Note that the words in italic you will have to change depending on your andrewID and which lab you are sumbitting, and the bold items are what the consoule prints out. Also note that as long as the shell promts you for the next command without printing an error message, your command was successfully completed.