Internet Services ARPA
(Communication among Systems w/ Different OS)
|
File Transfer Protocol (
ftp)
|
Transfer a file, or multiple files, from one system to another. This is often used when transferring files between a UNIX workstation and a Windows PC, VAX, etc. The following example shows copying the file
/tmp/krsort.c
from system2 (remote host) to the local directory on system1 (local host):
|
|
|
Comments
|
|
$ ftp system2
|
Issue ftp command
|
|
Connected to system2.
|
|
|
system2 FTP server (Version 4.1) ready.
|
|
|
Name
(system2:root): root
|
Log in to system2
|
|
Password required for root.
|
|
|
Password:
|
Enter password
|
|
User root logged in.
|
|
|
Remote system type is UNIX.
|
|
|
Using binary mode to transfer files.
|
|
|
ftp>
cd /tmp
|
cd
to
/tmp
on system2
|
|
CWD command successful
|
|
|
ftp>
get krsort.c
|
Get krsort.c file
|
|
PORT command successful
|
|
|
Opening BINARY mode data connection for
krsort.c
|
|
|
Transfer complete.
|
|
|
2896 bytes received in 0.08 seconds
|
|
|
ftp>
bye
|
Exit ftp
|
|
Goodbye.
|
|
|
$
|
|
In this example, both systems are running UNIX; however, the commands you issue through
ftp
are operating system-independent. The
cd
for change directory and
get
commands used above work for any operating system on which
ftp
is running. If you become familiar with just a few
ftp
commands, you may find that transferring information in a heterogeneous networking environment is not difficult.
Chances are that you are using your UNIX system(s) in a heterogeneous environment and may therefore use
ftp
to copy files and directories from one system to another. Because
ftp
is so widely used, I describe some of the more commonly used
ftp
commands:
|
ascii
|
Set the type of file transferred to ASCII. This means that you are transferring an ASCII file from one system to another.
binary
is usually the default.
Example:
ascii
|
|
binary
|
Set the type of file transferred to binary. This means that you are transferring a binary file from one system to another. If, for instance, you want to have a directory on your UNIX system that holds applications that you copy to non-UNIX systems, then you want to use binary transfer.
Example:
binary
|
|
cd
|
Change to the specified directory on the remote host.
Example:
cd /tmp
|
|
dir
|
List the contents of a directory on the remote system to the screen or to a file on the local system, if you specify a local file name.
|
|
get
|
Copy the specified remote file to the specified local file. If you don't specify a local file name, then the remote file name will be used.
|
|
lcd
|
Change to the specified directory on the local host.
Example:
lcd /tmp
|
|
ls
|
List the contents of a directory on the remote system to the screen or to a file on the local system, if you specify a local file name.
|
|
mget
|
Copy multiple files from the remote host to the local host.
Example:
mget *.c
|
|
put
|
Copy the specified local file to the specified remote file. If you don't specify a remote file name, then the local file name will be used.
Example:
put test.c
|
|
mput
|
Copy multiple files from the local host to the remote host.
Example:
mput *.c
|
|
bye/quit
|
Close the connection to the remote host.
Example:
bye
|
{% if main.adsdop %}{% include 'adsenceinline.tpl' %}{% endif %}
Other
ftp
commands are available in addition to those I have covered here. If you need more information on these commands or wish to review additional
ftp
commands, the UNIX manual pages for
ftp
are helpful.
|
telnet
|
Used for communication with another host using the telnet protocol. Telnet is an alternative to using
rlogin
, described later. The following example shows how to establish a telnet connection with the remote host, system2:
|
|
|
Comments
|
|
$ telnet system2
|
|
|
Connected to system2.
|
Telnet to system2
|
|
AIX version 4 system2
|
|
|
login:
root
|
Log in as root on system2
|
|
password:
|
Enter password
|
|
Welcome to system2. - rs6000 aix 4.3.1.0
|
|
|
$
|
AIX prompt on system2
|
|