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:
- From the Start Bar select Run... and enter:
- ftp redgum.bendigo.latrobe.edu.au
- Enter your normal Unix user name and password to log into your account as an
ftp user.
Try these ftp commands and make a note of what they do:
- help - first let's
see what sort of help our ftp provides
- ? lcd
- equivalent to help for that command
- help bye
- pwd - Display
the present working directory on Unix
- ls - Display
the names of the files in the current directory on Unix
- dir - whats the
difference between ls and dir?
- Use cd to change the Unix directory to your Programming Environment
directory
- Display the present working directory on Unix
- Display the names of the files in the current directory on Unix
- Change directory on Unix to your Tutorials directory
- Display the present working directory on Unix
- Display the names of the files in the current directory on Unix
- Change directory on Unix to the parent directory
- Display the present working directory on Unix
- Display the names of the files in the current directory
- 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.
- lcd - Change
directory on the PC. Note what the local drive is (lcd without any directory
changes to C:\)
- Use lcd to change the to the PC's H: drive (lcd H:\)
- 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")
- 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.
- use cd and ls to find a java source code file on Unix
- ascii - use this command to set the transfer mode
to ascii (text files are ascii)
- 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
- On the remote connection (Unix), ensure your directory is your Programming
Environment directory (or Tutorials directory)
- Use the ftp mkdir command to create a new Unix tmp directory
(called tmp) attached to the above directory
- Use cd to change directory to your tmp directory on Unix
- Use the ftp put command to transfer your new java program from
your PC account into this new tmp directory
- 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
- On the PC select Start->Programs->WS_FTP->WS_FTP95 LE to start
the program
- 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
- 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
- Check the arrow pointing to the left to transfer the file from Unix to the
PC
- Opening the file in Notepad to check that it transferred correctly
6. Clean up
- Delete the files in the new tmp directory using the Ws_ftp delete button
- Delete the new tmp directory using the Ws_ftp delete button
- 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.