FTP(1C)
NAME
ftp − file transfer program
USAGE
ftp [ −v ] [ −d ] [ −i ] [ −n ] [ −g ] [ host ]
DESCRIPTION
Ftp is the user interface to the ARPANET standard File Transfer Protocol. The program lets you transfer files to and from a remote network site.
If you specify the client host that ftp is to communicate with on the command line, ftp immediately attempts to establish a connection to an FTP server on that host. Otherwise, it will enter its command interpreter and await instructions from you. When ftp is awaiting commands, it prompts you with “ftp>”.
COMMAND INTERPRETATION
Ftp recognizes the following commands:
! Invoke a shell on the local machine.
? [ command ]
Perform the same function as help.
append local-file [ remote-file ]
Append a local file to a file on the remote machine. If remote-file is left unspecified, the local filename is used in naming the remote file. File transfer uses the current settings for type, format, mode, and structure.
ascii Set the file transfer type to network ASCII. This is the default type.
bell Sound a bell after each file transfer command is completed.
binary
Set the file transfer type to support binary image transfer.
bye Terminate the FTP session with the remote server and exit ftp.
cd remote-directory
Change the working directory on the remote machine to remote-directory.
close Terminate the FTP session with the remote server, and return to the command interpreter.
delete remote-file
Delete the file remote-file on the remote machine.
debug [ debug-value ]
Toggle the debugging mode. If an optional debug-value is specified, it is used to set the debugging level. When debugging is on, ftp prints each command sent to the remote machine, preceded by the string “-->”.
ls [ remote-directory ] [ local-file ]
Print a listing of the directory contents in remote-directory. Optionally, place the output in local-file. If no directory is specified, use the current working directory on the remote machine. If no local file is specified, output comes to the terminal.
form format
Set the file transfer form to format. The default format is “file”.
get remote-file [ local-file ]
Retrieve the remote-file and store it on the local machine. If the local file name is not specified, give it the same name it has on the remote machine. The current settings for type, form, mode, and structure are used while transferring the file.
glob Toggle filename globbing. With filename globbing enabled, each local file or pathname is processed for csh(1) metacharacters. These characters include the asterisk (*), question mark (?), square brackets ([ ]), tilde (~), and braces ({ }). The remote server globs remote files specified in multiple item commands, e.g., mput. With globbing disabled, all files and pathnames are treated literally.
hash Toggle hash-sign (#) printing for each data block transferred. The size of a data block is 1024 bytes.
help [ command ]
Print an informative message about the meaning of command. If no argument is given, print a list of the known commands.
lcd [ directory ]
Change the working directory on the local machine. If no directory is specified, change to the user’s home directory.
ls [ remote-directory ] [ local-file ]
Print an abbreviated listing of a directory’s contents on the remote machine. If remote-directory is left unspecified, use the current working directory. If no local file is specified, send the output to the terminal.
mdelete remote-files
Delete the specified files on the remote machine. If globbing is enabled, first expand the specification of remote files using ls(1).
mdir remote-files local-file
Obtain a directory listing of multiple files on the remote machine and place the result in local-file.
mget remote-files
Retrieve the specified files from the remote machine and place them in the current local directory. If globbing is enabled, first expand the specification of remote files using ls(1).
mkdir directory-name
Make a directory on the remote machine.
mls remote-files local-file
Obtain an abbreviated listing of multiple files on the remote machine and place the result in local-file.
mode [ mode-name ]
Set the file transfer mode to mode-name. The default mode is the “stream” mode.
mput local-files
Transfer multiple local files from the current local directory to the current working directory on the remote machine.
open host [ port ]
Establish a connection to the specified host FTP server. An optional port number may be supplied, in which case, ftp will attempt to contact an FTP server at that port. If the auto-login option is on (the default), ftp will also attempt to automatically log you in to the FTP server (see below).
prompt
Toggle interactive prompting. Interactive prompting occurs during multiple file transfers to allow you to selectively retrieve or store files. If prompting is turned off (the default), an mget or mput transfers all files.
put local-file [ remote-file ]
Store a local file on the remote machine. If remote-file is left unspecified, the local-file is used to name the remote file. File transfer uses the current settings for type, format, mode, and structure.
pwd Print the name of the current working directory on the remote machine.
quit Perform the same function as bye.
quote arg1 arg2 ...
Send the specified arguments, verbatim, to the remote FTP server. A single FTP reply code is expected in return.
recv remote-file [ local-file ]
Perform the same function as get.
remotehelp [ command-name ]
Request help from the remote FTP server. If a command-name is specified, supply it to the server as well.
rename [ from ] [ to ]
Rename the file from on the remote machine to the file to.
rmdir directory-name
Delete a directory on the remote machine.
send local-file [ remote-file ]
Perform the same function as put.
sendport
Toggle the use of PORT commands. By default, ftp attempts to use a PORT command to establish a connection for each data transfer. If the PORT command fails, ftp uses the default data port. When the use of PORT commands is disabled, no attempt is made to use PORT commands for each data transfer. The sendport command is useful for certain FTP implementations that ignore PORT commands but incorrectly indicate that they have been accepted.
status
Show the current status of ftp.
struct [ struct-name ]
Set the file transfer structure to struct-name. By default, the “stream” structure is used.
tenex Set the file transfer type to the one needed to talk to TENEX machines.
trace Toggle packet tracing.
type [ type-name ]
Set the file transfer type to type-name. If no type is specified, print the current type. The default type is network ASCII.
user user-name [ password ] [ account ]
Identify yourself to the remote FTP server. If the password is not specified and the server requires it, ftp prompts you for it (after disabling local echo). If an account field is not specified, and the FTP server requires it, you are prompted for it. Unless ftp is invoked with “auto-login” disabled, this process is done automatically on initial connection to the FTP server.
verbose
Toggle verbose mode. In verbose mode, all responses from the FTP server are displayed. In addition, if verbose is on, when a file transfer completes, statistics regarding the efficiency of the transfer are reported. By default, verbose is on.
Command arguments that have embedded spaces may be quoted.
NAMING CONVENTIONS
Files specified as arguments to ftp are processed according to the following rules:
1) If you specify the filename as a dash (−), ftp uses the standard input for reading and the standard output for writing.
2) If the first character of the file name is a pipe character (|), ftp interprets the remainder of the argument as a shell command. It then forks a shell, using popen(3) with the argument supplied, and reads (writes) from the standard output (standard input). If the shell command includes spaces, you must quote the argument; e.g., “| ls -lt”. A particularly useful example of this mechanism is “dir |more”.
3) If globbing is enabled (refer to the glob command above), ftp expands the names of local-files according to the rules used in csh(1).
FILE TRANSFER PARAMETERS
The FTP specification specifies many parameters that may affect a file transfer. The type may be ascii, image (binary), ebcdic, and local byte size. Ftp supports the ASCII and image types of file transfer.
Ftp supports only the default values for the remaining file transfer parameters: mode, form, and struct.
OPTIONS
You may specify options on the command line, or to the command interpreter.
−v Show all responses from the remote server and report on data transfer statistics.
−n Prevent “auto-login” upon initial connection. If auto-login is enabled, check the .netrc file in the user’s home directory for an entry describing an account on the remote machine. If no entry exists, use the log-in name on the local machine as the user identity on the remote machine. Ftp then prompts for a password and, optionally, an account with which to log in.
−i Turn off interactive prompting during multiple file transfers.
−d Enable debugging.
−g Disable filename globbing.
NOTES TO DOMAIN/IX USERS
For a node to accept incoming talk commands, it must be correctly configured to run DOMAIN/IX TCP/IP. See System Administration for DOMAIN/IX bsd4.2 for information on configuring TCP/IP.
CAUTIONS
Many FTP server implementations do not support some experimental operations such as printing a working directory.
If you attempt to abort a file transfer, the local ftp will probably have to be manually killed.