Command-line FTP Usage Instructions

This page is available on-line at http://www.feodorov.com/consulting/how2/command_line_ftp.html


1. Make sure your workstation is connected to Internet. For that, start a Netscape browser (command: netscape) and try to connect to a public site like www.google.com or www.netscape.com. If you cannot connect, that means there is no IP connectivity and ftp won't work. If you are able to load content from the web site, proceed to the next step.

2. Run ftp, specifying the name of the external ftp site you want to connect to:


IRIS> ftp somesite.somedomain.com


3. The program will try to establish a connection to the specified site. It the site can be reached, the ftp client will ask for the username:


Connected to somesite.somedomain.com.
220
somesite.somedomain.com FTP server ready.
Name (localhost:bob):



Enter a username valid on the destination ftp server.

4. If the username is accepted, the server will challenge you for a password:


331 Password required for bob.
Password:



Type in the password. The program will not echo the password characters as you type, for security reasons. Type carefully. If the password is accepted, the program will enter a command line interface:


230 User bob logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>



5. To upload a local file on the ftp server, change directory from within ftp interface to the directory where your file is located, using lcd command, set the transfer type according to the file type (binary / ascii) and upload the file with the put command. In case you want to place the file in a specific directory on the ftp server, you should also use the cd command, to change the remote directory. If you don't use cd command, the file will be placed in the ftp server's default upload directory, which usually is the home directory of your user.

Assuming the file you want to upload is /usr/people/bob/file.bin, and it is a binary file, and you want to upload it into /tmp directory on the remote server, the sequence of commands is:


ftp> lcd /usr/people/bob
Local directory now /usr/people/bob
ftp> binary
200 Type set to I.
ftp> cd /tmp
250 CWD command successful.
ftp> put file.bin
local:
file.bin remote: file.bin
200 PORT command successful.
150 Opening BINARY mode data connection for '
file.bin'.
226 Transfer complete.
4 bytes sent in 0.00 seconds (7.67 Kbytes/s)




6. To download a remote file on your workstation, change the remote directory from within ftp interface to the directory where the file is located, using cd command, set the transfer type according to the file type (binary / ascii) and download the file with get command. In case you want to place the file in a specific directory on the local workstation, you should use lcd command, to change local directory. If you don't use lcd command, the file will be placed in the current directory, which is usually the directory you started ftp from.

Assuming the remote file you want to download is /tmp/remote.bin, and it is a binary file, and you want to download it into a /usr/local/bob directory on your workstation, the sequence of commands is:


ftp> cd /tmp
250 CWD command successful.
ftp> binary
200 Type set to I.
ftp> lcd
/usr/local/bob
Local directory now /usr/local/bob
ftp> get remote.bin
local: remote.bin remote: remote.bin
200 PORT command successful.
150 Opening BINARY mode data connection for 'remote.bin' (4 bytes).
226 Transfer complete.
4 bytes received in 0.00 seconds (9.81 Kbytes/s)



7. If you want to have a visual indication of the transfer's progress, use hash command.


ftp> hash
Hash mark printing on (1024 bytes/hash mark).



8. To end the ftp session, type bye.


ftp> bye
221 Goodbye.
IRIS>