How to use UNIX File Transfer Protocol (FTP)
By Nicholas Seet
FTP enables files to be transferred from one machine on a network to
another. FTP is useful as it allows you to store or retrieve files from
any computer in the world. Many different FTP 'clients' or programs
have been written, but the first and most commonly available is the text
mode FTP which can always be found on Unix systems, or in 'DOS'
under Windows'95 or NT.
Learn by Syntax (advanced)
Just say someone tells you to 'Go and get the file list.txt from
ftp.cdrom.com/pub/games/' or you may have found a file in
'archie', the file searching program.
1. At your
command prompt type:
FTP starts the program, and connects to the site ftp.cdrom.com
2. You will
see something similar to:
>Connected to sunsite.cnlab-switch.ch.
>220 wcarchive.cdrom.com FTP server (Version wu-2.4.2(18) Thu
>Dec119:28:12 MET 1997) ready.
You will then see:
>331 Guest login ok, send your complete e-mail address as password.
Type in your email address. (You don't
really have to type in the stuff after the @ symbol)
After the welcome message, you are now
'in' the site.
We must now change our directory to the directory '/pub/games'.
- cd stands for Change Directory. Now we are in the 'pub'
- Generally, you will find downloadable material in the 'pub'
directory of most sites.
- You must also make sure that you only use capitals when the directory
has capitals in it, otherwise it won't work!
to see a list of all the files there.
You should see the 'games' directory in the list:
drwxr-xr-x 6 731 730 512 Nov 4 05:11 games
- You can tell that it is a directory because there is a 'd'
at the far left.
- If 'dir' does not work, then you must type 'ls
Use 'cd' to change into the
Use 'dir' to find the file:
to get a listing of all files which
start with 'l'. You should see:
-rw-rw-r-- 1 2066 ftp-game 234868 Jun 30 1997 list.txt
- Because there is no 'd' at the far left, you know that it is
a file, not a directory.
- The 234868 is the file size, it is 234,868 bytes big (approx. 234Kb).
It was last modified on the 30th June 1997.
To download, type:
- This will make your download in 'binary' form.
- This mode will always work for all files, whereas the default
mode 'ascii' will only work for text files.
- So always make sure you type 'bin' before you download or you
will get garbage!
and type 'y' when asked to
- 'list.txt' will now download, and will soon be on the
computer you ran 'ftp' from.
- Alternately, if you want to download multiple files, you could type:
'mget *', this would download *all* files in the directory; 'mget
l*' would download all files beginning with 'l'.
- If you do not wish to confirm each download one by one, type
'prompt' to turn that off. If you wish to have a download
indicator, type 'hash'.
- To upload a file you must be in a directory you are allowed to
- You would type 'put list.txt' if you wished to upload
'list.txt' or 'mput l*' to upload all files beginning with
'l' for example.
- Make sure that you type 'bin' again before you upload
Logging off. Type:
to close the connection and quit FTP.
- If you have any questions type either 'man ftp' (for
unix) or 'help ftp' (for windows) at your command prompt;
- ...or email email@example.com
Following are the basic commands
that will allow you to successfully ftp.
Click on them or scroll down for notes on usage.
Where the contents of [square brackets] are customizable and
[filespec] means either a full file name (ie. 'list.txt') or a
filename with wildcards
ie. 'l*' means all files beginning with 'l', and
'*.txt' means all files ending with '.txt'
- Connects to [sitename]
- Login: ftp
- Password: [emailaddress]
- Print working directory (tells you which directory you are in)
- Lists details about the filespec
- Alternate is 'ls -aFl'
- Changes to binary mode
- You must do this!
- Turns off confirming uploads/downloads
- Turn on hash indicators for download/upload status
- Multiple download of [filespec] files
- Uploads [filename] from your current local directory
- Uploads multiple files matching [filespec]
- Changes your local directory (the directory from which you started
- Allows you to suspend ftp and use your command prompt, type
'exit' to return to 'ftp'.