Files can be transferred between systems on the network using the ftp command. Files are usually transferred as ASCII files. Binary files can also be transferred. Use of ftp requires a valid userid and password on the remote system. The commands covered in this section are:
ftp establish a remote connection get move a file from the remote host to the local host put move a file from the local host to a remote host mget retrieve multiple files from a remote host mput send several files to a remote host mkdir create a new directory on a remote host cd change directories on a remote host dir list files in the current remote directory quit exit from ftp
For additional information about the ftp command, enter man ftp.
To establish a connection to a remote system, use the ftp command and after the connection is established, provide a valid userid and password:
>> ftp asnc90.asc.edu
Connected to asnc90.asc.edu. 220 asnc90 FTP server (Version 5.2 Fri Sep 7 14:09:58 CDT 1996) ready. Name (asnc90.asc.edu:asnxyz01): asnxyz01 331 Password required for asnxyz01. Password: 230 User asnxyz01 logged in. ftp>
The get command is used to transfer a file from the remote system to the local system. The syntax is:
ftp> get file1.x
200 PORT command successful. 150 Opening ASCII mode data connection for file1.x (14 bytes). 226 Transfer complete. local: file1.x remote: file1.x 15 bytes received in 0.04 seconds (0.37 Kbytes/s) ftp>
The put command is used to send a file from the local host to the remote host. The syntax is:
If the remote file name is omitted, the local file name will be used for both files.
ftp> put xyz.x file3.x
200 PORT command successful. 150 Opening ASCII mode data connection for file3.x. 226 Transfer complete. local: xyz.x remote: file3.x 15 bytes sent in 1e-06 seconds (1.5e+04 Kbytes/s) ftp>
The mget command is used to transfer multiple files from the remote host to the local host. Standard UNIX 'wildcard' characters can be used. The syntax is:
for example mget file* will transfer all files beginning with the characters 'file'.
ftp> mget file*
200 PORT command successful. 150 Opening ASCII mode data connection for file1.x (14 bytes). 226 Transfer complete. local: file1.x remote: file1.x 15 bytes received in 0.04 seconds (0.37 Kbytes/s) 200 PORT command successful. 150 Opening ASCII mode data connection for file2.x (14 bytes). 226 Transfer complete. local: file2.x remote: file2.x 15 bytes received in 0.05 seconds (0.29 Kbytes/s) ftp>
The mput command is used to transfer multiple files from the local host to the remote host. Standard UNIX 'wildcard' characters can be used. The syntax is:
for example mput file* will transfer all files beginning with the characters 'file'.
ftp> mput file*
200 PORT command successful. 150 Opening ASCII mode data connection for file1.x. 226 Transfer complete. local: file1.x remote: file1.x 15 bytes sent in 1e-06 seconds (1.5e+04 Kbytes/s) 200 PORT command successful. 150 Opening ASCII mode data connection for file2.x. 226 Transfer complete. local: file2.x remote: file2.x 15 bytes sent in 1e-06 seconds (1.5e+04 Kbytes/s) ftp>
The mkdir command is used to create a new subdirectory on the remote host. The syntax is:
ftp> mkdir demoftp
257 MKD command successful. ftp>
The cd command is used to change directories on the remote host. The syntax is:
ftp> cd demoftp
250 CWD command successful. ftp>
The dir command is used to get a listing of the files in the current remote directory. The syntax is:
ftp> dir
200 PORT command successful. 150 Opening ASCII mode data connection for /usr/ucb/ls. total 8 -rw-r----- 1 asnger01 u_staff 14 Jun 13 15:58 file1.x -rw-r----- 1 asnger01 u_staff 14 Jun 13 15:58 file2.x 226 Transfer complete. 135 bytes received in 0.13 seconds (1 Kbytes/s) ftp>
The quit command exits from the ftp session. The syntax is:
ftp> quit
221 Goodbye. >>
Alabama Supercomputer Authority Last modified on May 26, 1997