Computer Lab Week 11- ftp & zip


Home


This tutorial is in the PC labs (B1.53/B1.54)

1. Getting Started

2. Using command-line ftp

Start the command line version of ftp:

Try these ftp commands and make a note of what they do:

  1. help       - first let's see what sort of help our ftp provides
  2. ? lcd            - equivalent to help for that command
  3. help bye
  4. pwd        - Display the present working directory on Unix
  5. ls         - Display the names of the files in the current directory on Unix
  6. dir        - whats the difference between ls and dir?
  7. Use cd to change the Unix directory to your Programming Environment directory
  8. Display the present working directory on Unix
  9. Display the names of the files in the current directory on Unix
  10. Change directory on Unix to your Tutorials directory
  11. Display the present working directory on Unix
  12. Display the names of the files in the current directory on Unix
  13. Change directory on Unix to the parent directory
  14. Display the present working directory on Unix
  15. Display the names of the files in the current directory
  16. cd ~      - an alternative way to change back into your home directory on your Unix connection

Let's ftp a java file on Unix back to your Programming Environment directory on the PC.

  1. lcd        - Change directory on the PC. Note what the local drive is (lcd  without any directory changes to C:\)
  2. Use lcd to change the to the PC's H: drive (lcd H:\)
  3. Use lcd to change the local directory to your Programming Environment directory (e.g. lcd ProgEnv or lcd H:\ProgEnv use quotes around the file name and path if it contains any spaces e.g. lcd "H:\Prog Env")
  4. use lcd to change to your Programming Environment  Tutorials directory on the PC (e.g. lcd Tutorials or lcd H:\ProgEnv\Tutorials) The current directory should be displayed, check it is correct.
  5. use cd and ls to find a java source code file on Unix
  6. ascii   - use this command to set the transfer mode to ascii (text files are ascii)
  7. get unix-file-name pc-file-name        (transfer the file from Unix to the PC e.g. get Hello.java Hello.java)

You should have transferred your Java program onto your PC account.
Use Windows Explorer to check this.

3. Compile and Run the Java Program

Use Notepad to view your java file.

Run a DOS Prompt window (if this isn't available ion the menus, Click the Start button and select Run..., type in cmd, and click Ok)

In the DOS window:

Change the current drive and directory to where the new Java file is:

Firstly, to change drive to the H: drive, type:

H:

Then change directory to where your Java program is e.g. type:

cd \ProgEnv\Tutorials

Compile the java file.

javac your-java-file-name.java
e.g.
javac HelloWorld.java

Run the program

java your-java-file-name
e.g.
java Hello

4. Further ftp work - Uploading from a PC to Unix

  1. On the remote connection (Unix), ensure your directory is your Programming Environment directory (or Tutorials directory)
  2. Use the ftp mkdir command to create a new Unix tmp directory (called tmp) attached to the above directory
  3. Use cd to change directory to your tmp directory on Unix
  4. Use the ftp put command to transfer your new java program from your PC account into this new tmp directory
  5. Use the ls command to check that you have succeeded

5. Using ws_ftp

Do the following:

We will use ws_ftp to transfer the Rectangle program file from the last tutorial from Unix to the PC

  1. On the PC select Start->Programs->WS_FTP->WS_FTP95 LE to start the program
  2. Configuring a new connection:
    New
       Profile Name=redgum
       Host Name/Address= redgum.bendigo.latrobe.edu.au
       Host Type= Automatic Detect
       User ID= yourAccountName
       Password= yourPassword
                 Save Pwd: It is up to you!
    OK
  3. Once it connects alter:
    Local System: change directory to where you want to put the program on the PC
    Remote System: locate the program on Unix and select it
  4. Check the arrow pointing to the left to transfer the file from Unix to the PC
  5. Opening the file in Notepad to check that it transferred correctly

6. Clean up

  1. Delete the files in the new tmp directory using the Ws_ftp delete button
  2. Delete the new tmp  directory using the Ws_ftp delete button
  3. try ftping to the following ftp server. See the pub (public) directory. (user=anonymous, password=yourEmailAddress):
     ftp.mirror.aarnet.edu.au   huge amount of stuff

7. Winzip

Run Winzip (select Start>Programs>Winzip>Winzip9.0 SR-1)

Create a New zip file called myTutes.zip. Add your ProgEnv Tutorials directory to it. If you are unsure on how to use Winzip refer to the lecture notes

How large is the zip file?
What is the total size of the original files?
How much space was saved?

Create a new directory on the PC and unzip the files into it.

You may want to use ws_ftp to ftp the zip file to Unix as a backup.

Carefully delete the new directory. Delete the zip file.

8. Cygwin & ssh

Log onto an indy using Cygwin and ssh. This allows you to run commands that user a console (terminal) interface - simple input/output at the keyboard and to a terminal window (e.g. cd, ls, less, vi), not a things that require a Graphical User Interface (GUI) like gedit, firefox, java programs that use JOptionPane etc.

Log onto a PC and run Cygwin (Start > Cygwin > Cygwin Bash Shell)

In the Cygwin window type: ssh  your-unixuser-name@indy-name.bendigo.latrobe.edu.au

e.g. ssh fjsmith@indye.bendigo.latrobe.edu.au

Try a few commands.

9. Catch up on your tutorials

10. Work on your assignment


Written by Tim Whitfort.