The FTP client ftp

Gatting Started

To connecte your local machine to the remote machine, type

ftp machinename
where machinename is the fullname of the remote machine, e.g., purcell.cs.colostate.edu. If the name of the machine is unknown, you may type
ftp machinnumber
where machinnumber is the net address of the remote machine, e.g., 127.82.45.181. If the remote machine has been reached successfully, FTP responds by asking for a loginname and password.

ftp commands

command meaning
? to request help or information about the FTP commands
! to use linux command for local machine such as !ls
ascii to set the mode of file transfer to ASCII (this is the default and transmits seven bits per character)
binary to set the mode of file transfer to binary (the binary mode transmits all eight bits per byte and thus provides less chance of a transmission error and must be used to transmit files other than ASCII files)
bye or exit or quit to exit the FTP environment
cd to change directory on the remote machine
delete to delete (remove) a file in the current remote directory (same as rm in UNIX)
get to copy one file from the remote machine to the local machine
get ABC DEF copies file ABC in the current remote directory to (or on top of) a file named DEF in your current local directory.
get ABC copies file ABC in the current remote directory to (or on top of) a file with the same name, ABC, in your current local directory.
help to request a list of all available FTP commands
lcd to change directory on your local machine (same as UNIX cd)
ls to list the names of the files in the current remote directory
mkdir to make a new directory within the current remote directory
mget to copy multiple files from the remote machine to the local machine; you are prompted for a y/n answer before transferring each file
mput to copy multiple files from the local machine to the remote machine; you are prompted for a y/n answer before transferring each file
put to copy one file from the local machine to the remote machine
pwd to find out the pathname of the current directory on the remote machine
rmdir to to remove (delete) a directory in the current remote directory

The .netrc file

The .netrc file contains login and initialization information by the auto-login process. Creat a file ~/.netrc with permition 600 or 400 as exampled in the following

machine name1 login name password string
machine name2 login name password string
default login anonymous password user@site

'machin name'

Identify a remote machine name on the ftp command line. Once a match is made, the subsequence are processed, stopping when the end of file is reached or another machine or a default token is encountered.

'default'

This is the same as machine name except it mathes any name. It will be invoke if all machine names above it didn't get matched. So, it should be put after all machine tokens.

'macdef name'

It's contents begin with the next line and continue until a null line. If a macro named init is defined, it is automatically executed as the last step in the auto-login process. The defined macro can be called in the ftp clinet as $name.

macdef getmyfile
cd /abc/defghi/jklm
get myFile.txt
quit