FTP quick command guide.


When ftp is awaiting commands from the user the prompt

ftp>

is provided to the user. The following commands are most usefull:

help [command]

Print an informative message about the meaning of command. If no argument is given, ftp prints a list of the known commands.

open host

Establish a connection to the specified host FTP server.

user user-name [password]

Identify yourself to the remote FTP server. If the password is not specified and the server requires it, ftp will prompt the user for it (after disabling local echo).

close

Terminate the FTP session with the remote server, and return to the command interpreter.

bye

Terminate the FTP session with the remote server and exit ftp. An end of file will also terminate the session and exit.

! [command]

Invoke an interactive shell on the local machine.

binary

Set the file transfer type to support binary image transfer.

pwd

Print the name of the current working directory on the remote machine.

cd remote-directory

Change the working directory on the remote machine to remote-directory.

ls [remote-directory]

Print a listing of the contents of a directory on the remote machine, like the unix list directory command.

get remote-file

Retrieve the remote-file and store it on the local machine.

reget remote-file

Reget acts like get, except that if local-file exists and is smaller than remote-file, local-file is presumed to be a partially transferred copy of remote-file and the transfer is continued from the apparent point of failure. This command is useful when transferring very large files over networks that are prone to dropping connections.

put local-file

Store a local file on the remote machine.

prompt

Toggle interactive prompting. Interactive prompting occurs during multiple file transfers to allow the user to selectively retrieve or store files.

mget remote-files

Expand the remote-files on the remote machine and do a get for each file name thus produced.

mput local-files

Expand wild cards in the list of local files given as arguments and do a put for each file in the resulting list.


Aborting a file transfer

To abort a file transfer, use the terminal interrupt key (usually Ctrl-C). Sending transfers will be immediately halted. Receiving transfers will be halted by sending a ftp protocol ABOR command to the remote server, and discarding any further data received.


The .netrc File

The .netrc file contains login and initialization information used by the auto-login process. It resides in the user's home directory. The following tokens are recognized; they may be separated by spaces, tabs, or new-lines:

machine name

Identify a remote machine name. The auto-login process searches the .netrc file for a machine token that matches the remote machine specified on the ftp command line or as an open command argument. Once a match is made, the subsequent .netrc tokens are processed, stopping when the end of file is reached or another machine or a default token is encountered. Exmaple:

ftp.techno.ru login ftp password user@
ftp.demos.su login ftp password [email protected]

default

This is the same as machine name except that default matches any name. There can be only one default token, and it must be after all machine tokens. This is normally used as:

default login anonymous password user@site

thereby giving the user automatic anonymous ftp login to machines not specified in .netrc. This can be overridden by using the -n flag to disable auto-login.

login name

Identify a user on the remote machine. If this token is present, the auto-login process will initiate a login using the specified name.

password string

Supply a password. If this token is present, the auto-login process will supply the specified string if the remote server requires a password as part of the login process. Note that if this token is present in the .netrc file for any user other than anonymous, ftp will abort the auto-login process if the .netrc is readable by anyone besides the user.


Environment

Ftp utilizes the following environment variables.

HOME For default location of a .netrc file, if one exists.

SHELL For default shell.


Bugs

Correct execution of many commands depends upon proper behavior by the remote server. An error in the treatment of carriage returns in the 4.2BSD ascii-mode transfer code has been corrected. This correction may result in incorrect transfers of binary files to and from 4.2BSD servers using the ascii type. Avoid this problem by using the binary image type.


To read more about ftp look here