Turning in Work
In this class you'll be asked to turn in work in a number of different forms, but arguably the most important involves uploading files to course server. There are a few different ways that you might do this, but all of them involve getting your file(s) into your folder on our server at
/home/yourUserID/forInstructor/
For electronic documents—programs, text files, etc.—this is where you turn in your work, and where I'll pick up your documents for evaluation.
Logging on to the server
As part of this class, you have an account on our course server. With your userID and your password, you can use your computer's Terminal to log on to the server using a Secure Shell, (ssh):
$ ssh userID@server.name userID@server.name's password: Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-85-generic x86_64) . . userID@server:~$
Once you've logged on to the server, you'll find yourself in your home directory, which initially will be empty. Here you can use standard commands to interact with the server:
ls <location>
- list files in a directorycd <location>
- change directory to a new locationcp <oldFile> <newFile>
- create a new copy of a filemv <fileName> <newLocation>
- move a file from one place to anothermkdir <directoryName>
- create a new directory at the current locationrm <fileName>
- remove a filepwd
- print current directory location
You can use the following symbols to help you navigate the file structure:
- your current directory can be indicated with a dot:
.
- the directory level just above is indicated with two dots:
..
- your home directory is indicated with a tilde:
~
- the computer's root directory is indicated with a forward slash:
/
Note that directories and files are referred to using either an absolute path or a relative path:
- An absolute path is given relative to the root directory
/
: - To list the files on the Desktop using an absolute path:
$ ls /home/username/Desktop
- To list all the files in the home directory using an absolute path:
$ ls /home/username/
- To move a file from the user's Documents to the Desktop using absolute paths:
$ mv /home/username/Documents/filename /home/username/Desktop/
- A relative path is given relative to the current directory:
- To list the files on the Desktop while in your home directory, using a relative path:
$ ls ./Desktop
- To list all the files in the Documents directory while on the Desktop, using a relative path:
$ ls ../Documents
- To move a file from the user's Documents to the Desktop, while in the home folder, using relative paths:
$ mv ./Documents/filename ./Desktop/
Once you have finished using the server, be sure to log out using the exit
command or the ^d
command.
Transferring files from your own computer to the server
If you're not currently logged on to the server, the easiest way to upload your document is probably the Secure Copy command, scp
which has the the same general format as before:
scp <source> <destination>
Assuming I've just launched a Terminal and I want to upload a file from a directory code
located on my Desktop, here's what I'd do:
$ cd ~/Desktop/code $ ls HelloWorld.java $ scp -P 1030 HelloWorld.java studentID@server.name:~/forInstructor studentID@server.name's password: HelloWorld.java 100% 1025 1.0KB/s 00:00 $
In the same way, you can use the scp
command to download a file from the instructor, located in his Public directory on the server, to the current directory on your computer:
$ scp -P 1030 studentID@server.name:/home/rwhite/apcs/Public/instructors_file.txt . instructors_file.txt 100% 0 0.0KB/s 00:00
Creating a zipped directory
If you have multiple files that you need to upload, or a directory of files that you need to upload, you need to first zip those files together into a single file. To do this:
- On Apple machines
Control-click on the directory (folder) that you want to zip and select Compress "directoryName". The original folder will remain as it was, but a copy of the folder and its contents will be created as a single file called directoryName.zip. It's this file that you upload to your folder in the Dropbox.
- On Windows machines
Right-click on the directory (folder) and select Send to > Compressed (zipped) folder. The original folder will remain as it was, but a copy of the folder and its contents will be created. Name this file directoryName.zip. It's this file that you upload to your folder in the Dropbox.
- On Linux machines
From the Command Line usetar -czvf directoryName.tgz directoryName
, or in some systems, right-click on the directory and select Create Archive... .
Details about your Home folder
Your forInstructor
folder is the only place that you can turn in work—emailed work, printed work, or file submitted on a USB stick won't be accepted—so make sure that you take that fact into account when you're working against a deadline.
Your home directory ~
and all its subdirectories are owned by you, and you usually have complete read, write, and execute privileges in that folder. Among other things, this means that if you submit two assignments with the same name, the assignment you submitted more recently will overwrite the first one, and there's no getting it back. So be sure to name your program appropriately according to the assignment instructions given in class, on the assignment, or on the course calendar.
We have material to cover and a schedule to keep, so late assignments are typically not accepted.