ftp(1) ftp(1)
NAME
ftp - file transfer program
SYNOPSIS
ftp [-B|-S] [-dgintvL] [-F value] [-N value] [-W value]
[remotesystem]
DESCRIPTION
This description is divided into the following sections:
⊕ Introduction
⊕ Synopsis and option description
⊕ ftp commands
- Functional overview
- Alphabetical description
⊕ Conventions for local file names
⊕ Aborting a file transfer
⊕ File transfer parameters
⊕ The .netrc file
⊕ Note on error messages
⊕ Examples
⊕ Files
Introduction
The ftp command is the user interface to the ARPANET standard File
Transfer Protocol (FTP). ftp transfers files to and from computers
within a network. For ftp to work, the remote system must also have a
Reliant UNIX or UNIX operating system.
You can set up a connection to the remote system in one of two ways:
- by specifying the remote system when calling ftp
- by specifying the remote system in an ftp open command
The system on which you call ftp is always the local system.
If the remote system is running Reliant UNIX or UNIX (V5.4), each ftp
session is logged on the remote system in the /var/adm/wtmp file, pro-
vided this file has been created.
Page 1 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
OPTIONS
No option and no argument specified:
ftp simply starts the local ftp command interpreter. You can then
use any ftp commands that do not directly affect file transfer or
perform operations on the remote system, i.e. !, ?, bell, case,
cr, debug, glob, hash, help, lcd, macdef, nmap, ntrans, runique,
sendport, status, sunique and verbose.
No option specified:
ftp sets up a connection to the FTP daemon on the specified sys-
tem.
-B The -B option sets the LIBSOCKETBSD=YES environment variable for
the ftp command. This means that BSD sockets will be used.
-S The -S option sets the LIBSOCKETBSD=NO environment variable for
the ftp command. This means that STREAMS sockets will be used.
Note:
The -B or -S option overrides the current value of LIBSOCKETBSD
in the shell environment. If neither -B nor -S is set, the
behavior is determined at startup by setting LIBSOCKETBSD.
-d (debug) Enables debugging. ftp displays each command sent to the
remote system on the screen (also refer to the ftp debug com-
mand).
Note:
With regard to system security, please note the following if you
use the -d option when calling ftp:
If you log in on the remote system with the user command, the
system prompts you for a password. As you type the password in,
it will in this case be echoed to the screen, not blanked out as
it usually is.
-g (glob) Disables file name expansion, also known as globbing (also
refer to the ftp glob command).
-i (interactive) Disables the prompt function. This means that when
multiple files are transferred or deleted using mget, mput or
mdelete, ftp prevents you from having to confirm command execu-
tion for each file individually. You can enable the prompt func-
tion again during the session by using the ftp prompt command.
-n (no auto-login) Suppresses automatic login name and password
retrieval on connection setup. You then have to use the ftp user
command for any subsequent login to the remote system.
Page 2 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
-n not specified:
ftp checks the .netrc file in your home directory on the local
system, looking for a login name for the remote system. If no
such entry is present, or if the .netrc file does not exist, ftp
prompts you for a login name and a password. If you have the same
login name on both the local and remote systems, you only need to
press <RETURN> when requested and then enter your password.
On the contents and format of the .netrc file, refer to "The
.netrc file".
-t (trace) Enables packet tracing (currently not implemented).
-v (verbose) Displays all responses from the remote system and logs
the progress of the file transfer on the screen. This display
function is enabled by default if ftp is running interactively
(also refer to the ftp verbose command).
-L timeoutvalue
Sets the "Linger-on-Close-Timeout" value. The default is 480
seconds.
The -L option can alter the behavior of "Linger-on-Close". This
refers to what happens when the ftp client has transferred all of
its data to the system kernel and then closes the file descrip-
tor. By default, the TCP endpoint sending the data remains active
for another six minutes (480 seconds) in order to transfer any
data that has not been received by the remote end. This timeout
value can be too small, however, if the sender, receiver, or net-
work are too slow, considering that the system kernel can buffer
large amounts of data. This can then lead to loss of data on the
receiving side. To avoid this, the timeout value for Linger-on-
Close can be changed using the -L option of the ftp client. The
upper limit for the value is 32766 seconds (approx. 4½ hours).
-F value
value determines the block size for file transfer. This means
that the file being transferred will be read and written in
blocks of this size.
Values between 1 KB and 16 MB are permitted. The default is 32
KB.
-N value
value determines the size of the internal ftp send/receive
buffer.
Values between 1 KB and 16 MB are permitted. The default is 32
KB.
Page 3 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
-W value
value is used as the socket option SOSNDBUF or SORCVBUF for
data transfer.
Values between 4 KB and 384 MB are permitted. The default is 24
KB.
In the case of all three options, i.e. -F, -N and -W, you can
specify value as follows:
nk or nK The value is interpreted as n kilobytes.
nm or nM The value is interpreted as n megabytes.
n (digit only) The value is interpreted as n bytes.
remotesystem
Name of the remote system.
remotesystem not specified:
ftp simply starts its command interpreter. You can then use any
ftp commands that do not directly affect file transfer or perform
operations on the remote system, e.g. !, bell, glob, hash, lcd,
macdef, status.
You can then use the ftp open command to set up a connection to
another system.
FTP COMMANDS
The following section first gives you an overview of all the ftp com-
mands arranged by function. Some of the commands appear more than
once.
The overview is followed by a description of the ftp commands in
alphabetical order.
Some ftp commands are toggle functions.
You can use status to check the current settings on your system.
The toggle commands have the following default settings.
Page 4 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
________________________
| Command | on | off |
|__________|_____|______|
| bell | | x |
|__________|_____|______|
| case | | x |
|__________|_____|______|
| cr | x | |
|__________|_____|______|
| debug | | x |
|__________|_____|______|
| glob | x | |
|__________|_____|______|
| hash | | x |
|__________|_____|______|
| nmap | | x |
|__________|_____|______|
| ntrans | | x |
|__________|_____|______|
| prompt | x | |
|__________|_____|______|
| runique | | x |
|__________|_____|______|
| sendport | x | |
|__________|_____|______|
| sunique | | x |
|__________|_____|______|
| verbose | x | |
|__________|_____|______|
Functional overview
In the following section, the information in parentheses indicates
that
- the command is enabled (on) or disabled (off) by default,
- the value shown is the default.
Unique abbreviations are allowed for all ftp commands.
Set up connection to remote system
open Set up connection to remote system
proxy Control simultaneous connection to two remote FTP daemons
Page 5 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
Terminate or interrupt ftp session, clear down connection
bye Terminate the ftp session
quit Terminate the ftp session
! Call subshell or execute shell command on local system
close Clear down connection to remote FTP daemon
disconnect Clear down connection to remote FTP daemon
Log in on remote system
user Log in on the remote system as user
account Log in as resource user
Display help information
verbose Display responses from FTP daemon, log file transfer (on)
help Display help information on ftp commands
? Display help information on ftp commands
remotehelp Display help information on ftp commands on remote system
status Display current settings of ftp commands
debug Toggle debugging (off)
hash Toggle hash-sign printing for each data block transferred
(off)
trace Toggle packet tracing
Transfer files to remote system
put Transfer one file to remote system
send Transfer file to remote system
mput Transfer multiple files to remote system
append Append file to file on remote system
Page 6 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
Transfer files to local system
get Transfer one file to local system
recv Transfer one file to local system
mget Transfer multiple files to local system
Create, list, change and delete directory
mkdir Create remote directory
pwd Print name of current directory on remote system
ls List contents of remote directory
dir Display long listing of contents of remote directory
mls Write list of remote files to local file
mdir Write long listing of remote files to local file
cd Change remote directory
cdup Change to parent directory of current remote directory
lcd Change local directory
rmdir Delete remote directory
Append and delete files
append Append local file to remote file
delete Delete remote file
mdelete Delete multiple remote files
Process file names
rename Rename remote file
glob Toggle file name expansion (on)
case Toggle uppercase to lowercase conversion for file names
mget transfers (off)
runique Toggle storing of files on local system with unique names
(off)
sunique Toggle storing of files on remote system with unique
names (off)
Page 7 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
nmap Toggle file name expansion for transfers to and from
non-UNIX systems (off)
ntrans Toggle character translation mechanism for transfers to
and from non-UNIX systems (off)
Set file transfer parameters
form Set transfer format (non-print)
mode Set transfer mode (stream)
struct Set transfer structure (file)
type Set transfer type (ascii)
ascii Set transfer type to ASCII code
binary Set transfer type to image binary code
tenex Set transfer type for communication with TENEX systems
Special commands for transfer to and from non-UNIX systems
nmap Toggle file name expansion (off)
ntrans Toggle character translation mechanism (off)
cr Toggle output of carriage return character with ascii
transfer type (on)
sendport Toggle use of PORT commands (on)
tenex Set transfer type for communication with TENEX systems
Miscellaneous
! Execute shell command or call subshell on local system
$ Execute macro previously defined with macdef
bell Toggle acoustic end-of-command signal (off)
case Toggle uppercase to lowercase conversion for file names
during mget transfers (off)
cr Toggle output of carriage return character with ascii
transfer type (on)
glob Toggle file name expansion (on)
Page 8 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
hash Toggle hash-sign printing for each data block transferred
(off)
macdef Define macro
nmap Toggle file name expansion for transfers to and from
non-UNIX systems with different naming conventions (off)
ntrans Toggle character translation mechanism for transfers to
and from non-UNIX systems with different naming conven-
tions (off)
prompt Toggle prompting during multiple file transfers (on)
proxy Control simultaneous connection to two remote FTP daemons
quote Test FTP daemon
reset Resynchronize command/reply sequencing with remote FTP
daemon
sendport Toggle use of PORT commands (on)
status Display current settings of ftp commands
trace Toggle packet tracing
verbose Display responses from FTP daemon, log file transfer (on)
Alphabetical description
Unique abbreviations are allowed for all ftp commands.
![shcommand]
Runs shcommand as a shell command on the local system.
shcommand not specified:
Your ftp session is interrupted and a subshell called.
To terminate the subshell you press <CTRL-D>.
$macroname [argument ...]
Executes the macro macroname that was previously defined using
the ftp macdef command. Any arguments specified are not expanded.
? [ftpcommand ...]
Displays a description of the ftp command specified. You can
specify more than one command.
help performs the same function.
Page 9 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
ftpcommand not specified:
You are shown a list of all the ftp commands known to the local
system.
account [password]
Enables access to password-protected resources after a successful
login on the remote system.
password not specified:
You are prompted for the password by the remote FTP daemon.
append localfile [remotefile]
Appends a local file to a file on the remote system.
The current values for type, format, mode and structure remain
unchanged.
remotefile not specified:
The name of the local file is used by default.
If you have enabled the ftp functions nmap and ntrans and speci-
fied appropriate arguments, the local name is processed in accor-
dance with these arguments on the remote system.
ascii
Sets the file transfer type to ASCII.
Since ascii is the default value, you only need to use this com-
mand if the file transfer type has previously been changed (see
tenex, type and binary).
bell Toggle acoustic end-of-command signaling. Default: off. When bell
is on, the signal sounds when the following ftp commands have
terminated: append, dir, get, ls, mdelete, mdir, mget, mls, mput,
put, quote, recv, send.
binary
Sets the file transfer type to image (binary code transfer). This
is required when transferring program files or when communicating
with systems that do not work with ASCII code (also refer to
ascii, tenex and type).
bye Terminates the ftp session with the remote FTP daemon and quits
ftp. quit and <CTRL-D> perform the same function.
case Toggles uppercase to lowercase conversion for file names during
mget file transfers. Default: off.
Page 10 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
When case is on, file names written in uppercase only on the
remote system are written in lowercase on the local system.
cd [remotedir]
Changes to the remotedir directory on the remote system.
remotedir not specified:
ftp prompts you for a directory.
cdup Changes to the parent directory of the current remote directory.
close
Quits the FTP daemon on the remote system and return control to
the ftp command interpreter on the local system. Any macros
defined during the session are erased.
disconnect performs the same function.
cr Toggles output of the carriage return character CR. Default: on.
Records in ASCII files are terminated by CR/LF pairs (carriage
return/line feed). On output, however, LF alone indicates to any
UNIX system that it should write the text on a new line and at
the start of the line. For this reason, all CRs are removed
internally; LF then stands for LF/CR.
In file transfers with non-UNIX systems, it is possible that
there will be single LF characters. If you now send ASCII files,
these LFs can only be distinguished from CR/LF pairs if cr is set
to off.
debug
Toggles debugging mode. Default: off.
When debug is on, ftp displays each command sent to the remote
system (see also -d option).
Note:
With regard to system security, please note the following if you
use this command:
If you log in on the remote system with the user command, the
system prompts you for a password. As you type the password in,
it will in this case be echoed to the screen, not blanked out as
it usually is.
delete [remotefile]
Deletes remotefile from the remote system.
To delete multiple files you use mdelete.
Page 11 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
remotefile not specified:
ftp prompts you for a file name.
dir [remotedir] [localfile]
Writes the contents of the specified remote directory to the
specified local file.
remotedir not specified:
Defaults to the current remote directory.
localfile not specified:
The contents of the directory are listed on the screen.
disconnect
Quits the FTP daemon on the remote system and returns control to
the ftp command interpreter on the local system (see close).
form [non-print]
Sets the file transfer format to non-print. This format is set by
default. No other formats are currently supported. For this rea-
son, using this command always produces the following message:
We only support non-print format, sorry
get [remotefile] [localfile]
Retrieves the specified file from the remote system and stores it
on the local system under the name localfile.
The current values for type, format, mode and structure are used
for the file transfer.
remotefile not specified:
ftp prompts you for the name of a remote file.
localfile not specified:
The transferred file is given the same name as it has on the
remote system.
If you have enabled case, nmap and ntrans and specified appropri-
ate arguments, the name of the remote file is processed in accor-
dance with these arguments on the local system.
glob Toggles file name expansion for mget, mput and mdelete. Default:
on.
For mput, expansion is performed as in the shell (the metacharac-
ters *, ? and [ are processed).
Page 12 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
For mget and mdelete, each remote file name is expanded
separately on the remote system.
When glob is off, all file names are handled literally.
File name expansion can also be disabled using the -g option.
hash Toggles hash-sign printing for each data block transferred.
Default: off.
The size of a data block is 8192 bytes.
help [ftpcommand ...]
Displays a description of the specified ftp command. You can
specify more than one command (see ?).
lcd [dir]
Changes the current directory on the local system.
dir not specified:
You change to your home directory on the local system.
ls [remotedir] [remotefile]
Writes the names of all files in the specified remote directory
to the specified local file.
remotedir not specified:
Defaults to the current directory on the remote system.
localfile not specified:
The file names are listed on the screen.
macdef [macroname]
Starts definition of a macro called macroname. macroname may be
any character string. After starting the definition, you define
the body of the macro by entering ftp commands. You can then exe-
cute the macro using $macroname.
You can define up to 16 macros per ftp session, with a limit of
4096 characters in total. When you quit a remote ftp daemon with
close or disconnect, all the macros defined before connection
cleardown are erased. You must define any macros that you want to
use throughout the session before setting up the connection.
macroname not specified:
ftp prompts you for a name.
Page 13 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
A macro comprises
- command lines
- a null line
Command lines
Command lines are separated by newline characters, each line con-
taining an ftp command to be executed.
In processing each command line, the macro processor searches for
arguments that include one of the special characters $ and \. The
processor compares these characters with the corresponding argu-
ments in the macro invocation command line, replacing them where
necessary as follows:
$n replaced by the nth argument in the macro invocation com-
mand line.
$i replaced by the ith command-line argument during the ith
loop pass.
\char replaced by the character char. This enables the special
character $ to be escaped with \, for example.
Null line
A null line comprises two consecutive newline characters, e.g.
<RETURN> <RETURN>. This concludes the macro definition.
mdelete [remotefile ...]
Deletes the specified files on the remote system.
If prompt is set to on, ftp prompts you for a confirmation of
each file to be deleted. To confirm, you can enter:
<RETURN> file is to be deleted
y (yes) file is to be deleted
n (no) file is not to be deleted; list next file
remotefile not specified:
ftp prompts you for the names of the files to be deleted.
mdir [remotefile ...] [localfile]
Writes a long listing of the specified remote files to
localfile. Using a dash as the local file name causes the remote
files to be listed on your screen. If you enter neither of the
arguments, ftp prompts you for them.
Page 14 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
If glob is set to on, the file names for remotefile are
expanded.
If prompt is set to on, ftp requests confirmation that the file
name specified last is indeed the target file:
output to local-file: localfile?
As confirmation, you can enter:
<RETURN> target file is to be written
y (yes) target file is to be written.
n (no) target file is not to be written; ftp does noth-
ing
remotefile not specified:
ftp assumes that localfile is present on the remote system and
is to be listed, and prompts you for a target file on the local
system. No error messages are issued.
localfile not specified:
If you have specified multiple files for remotefile, ftp asks if
the last name specified is the target file.
If glob is set to on, however, and you specify only one file name
to be expanded for remotefile, e.g. file.*, ftp prompts you
additionally for the name of a target file.
mget [remotefile ...]
Copies the specified files from the current remote directory to
the current local directory. If remotefile is the name of a
directory, it is not transferred and no error message is issued.
If glob is set to on, the specified file names are expanded on
the remote system.
If you have enabled case, nmap and ntrans, and specified
appropriate arguments, each remote file name is processed accord-
ingly on the local system.
If prompt is set to on, ftp prompts you for confirmation for each
file to be transferred (see mdelete).
remotefile not specified:
ftp prompts you for the names of the files to be transferred.
Page 15 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
mkdir [dir]
Creates the directory dir on the remote system.
dir not specified:
ftp prompts you for the name of the directory to be created.
mls [remotefile ...] [localfile]
Writes only the names of the specified remote files to
localfile, unlike mdir. Otherwise mls functions in the same way
as mdir.
mode [stream]
Sets the file transfer mode to stream. This mode is set by
default. No other modes are currently supported. For this reason,
using this command always produces the following message:
We only support stream mode, sorry.
mput [localfile ...]
Transfers the specified local files to the current directory on
the remote system. If localfile is a directory, ftp prompts you
for confirmation but then issues the message:
filename: not a plain file
Directories cannot be transferred.
The access permissions of the new remote files are set to
rw-rw-rw-.
If glob is set to on, the specified file names are expanded on
the remote system.
If you have enabled nmap and ntrans, and specified appropriate
arguments, each name of a local file is processed in accordance
with the arguments on the remote system.
If prompt is set to on, ftp prompts for confirmation for each
file to be transferred (see mget).
localfile not specified:
ftp prompts you for the name of the files to be transferred.
nmap [inpattern outpattern]
Toggles the file name mapping mechanism. Default: on. This com-
mand is required if you are connected to non-UNIX systems that
use different file naming conventions.
Page 16 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
File names are mapped on the remote system if you
- specify both arguments in nmap
- transfer multiple files with mput
- transfer a file with put or send but do not specify a file
name for the remote file
File names are mapped on the local system if you
- specify both arguments in nmap
- transfer multiple files with mget
- transfer a file with get or recv but do not specify a file
name for the local file
Mapping is performed in accordance with the patterns that you
enter as arguments. Any special characters in the pattern must be
escaped with a backslash \ if they are to be handled literally.
$1, $2, ..., $9, [, ] and commas are special characters.
inpattern
Pattern for existing names of files to be transferred.
inpattern comprises individual characters of these file
names to be taken literally and/or sequences of the special
characters $1 through $9.
Example 1:
The following three files are located on the remote system:
- dpt3
- dpt3.personnel
- dpt3.personnel.old
You want to transfer these files to the local system. The
inpattern might look like this:
$1.$2.$3
The special characters take the following values:
- $1: dpt3
- $2: personnel
- $3: old
Page 17 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
The dots between the special characters are taken literally
from the original file names.
outpattern
Pattern for the final names of the files being transferred.
outpattern comprises individual characters of these file
names to be handled literally, blanks, and/or sequences of
the special characters $0 through $9 as well as [, ] and
commas.
$0 is replaced by the original file name. $1 through $9 are
replaced by the corresponding values in inpattern. A
sequence [$a,$b] is replaced by the value of $a as defined
in inpattern provided it is not null, otherwise by the value
of $b as defined there (a and b: digits between 1 and 9).
Example 2:
You want to give the files used in Example 1 new names on
the local system. To do this, you enter the following out-
pattern:
m-$1.[$2,proc].[$3,91]
The new names are then constructed as follows:
m- string to be prefixed to all new names
$1 value of $1 from inpattern, i.e. dpt3
. then a dot
[$2,proc] value of $2 from inpattern, i.e. personnel, if
present in original file name, otherwise append
the string proc
. then another dot
[$3,91] value of $3 from inpattern, i.e. old, if present
in original file name, otherwise append the year
91
If you now transfer the files using mget, the file names on
the local system are
- m-dpt3.personnel.91
- m-dpt3.personnel.old
- m-dpt3.proc.91
Page 18 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
No argument specified:
The nmap function is disabled.
ntrans [inchar [outchar]]
Toggles the file name character translation mechanism. Default:
on. This command is required if you are connected to non-UNIX
systems that use different file naming conventions.
Characters in file names are translated on the remote system if
you
- specify at least one inchar in ntrans
- transfer multiple files with mput
- transfer a file with put or send but do not specify a file
name for the remote file
Characters in file names are translated on the local system if
you
- specify at least one inchar in ntrans
- transfer multiple files with mget
- transfer a file with get or recv but do not specify a file
name for the remote file
inchar
Character in existing names of files to be transferred. This
character is to be converted into another character. You can
specify more than one character, but there must be no blanks
between them. Each inchar is converted only once.
Example 1:
The following three files that you want to transfer to the
local system are located on the remote system:
- HelenaKG
- Hello1
- Helloscript
The naming conventions on the local system do not, however,
permit uppercase letters or underscores. Also, each e is to
be changed to an a, and script abbreviated to scr. inchar
would then look like this:
HKGeipt
Page 19 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
outchar
Character to which inchar is to be converted in the new file
name. You can specify more than one character, but there
must be no blanks between them. The order of the new charac-
ters must correspond to the order in inchar. If you fail to
specify a character for the last character or characters in
inchar, these characters are omitted from the new file name.
Example 2:
outchar must look like this to correspond to inchar in Exam-
ple 1:
hkg.a
If you now transfer the files with mget, you generate the
following file names on the local system:
- halana.kg
- hallo.1
- hallo.scr
outchar not specified:
All characters in inchar are omitted from the new file name.
No argument specified:
The ntrans function is disabled.
open system [portnumber]
Connects the local system with the FTP daemon on the remote sys-
tem system. You can also specify a portnumber; ftp then attempts
to reach the FTP daemon via this port.
prompt
Toggles the confirmation prompt for mdelete, mget and mput.
Default: on. If this function has been on, all the files speci-
fied are transferred/deleted without confirmation.
proxy [ftpcommand]
Controls a connection to two remote systems simultaneously. This
enables you to transfer files between the two remote systems.
proxy only functions, however, if the PASV command is supported
on the second remote system (see remotehelp).
The first time you use proxy, you should proceed as follows:
1. Set up a connection between the local system and the first
remote system.
Page 20 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
2. From the existing connection, set up the connection to the
second remote system.
3. Check which ftp commands are available on the second remote
system.
4. Execute other ftp commands.
5. Clear down the connection to the second remote system.
Example (without output)
$ ftp remotesystem1
ftp> proxy open remotesystem2
ftp> proxy ?
ftp> proxy mget *
ftp> proxy close
The following ftp commands behave differently when prefaced by
proxy:
open The .netrc file is not executed again.
close Defined macros are not erased.
get and mget
Files are transferred from the first remote system to the
second.
put, mput and append
Files are transferred from the second remote system to
the first.
put [localfile] [remotefile]
Retrieves the specified file from the local system and stores it
on the remote system under the name remotefile.
The current values for type, format, mode and structure are used
for the file transfer.
The access permissions of the new remote file are set to
rw-rw-rw-.
localfile not specified:
ftp prompts you for the name of a local file.
remotefile not specified:
The transferred file is given the same name as it has on the
local system.
Page 21 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
If you have enabled case, nmap and ntrans, and specified
appropriate arguments, each name of a remote file is processed in
accordance with the arguments on the local system.
pwd Displays the name of the current directory on the remote system.
quit Quits the ftp session (see bye).
quote arg1 arg2 ...
Passes the specified arguments to the remote FTP daemon.
Using quote, experts on the FTP protocol can test an FTP daemon
and execute special functions that are not implemented in normal
ftp user commands.
arg1, arg2: ftp commands.
recv remotefile [localfile]
Retrieves the specified file from the remote system and stores it
on the local system under the name localfile (see get).
remotehelp [ftpcommand]
Displays a description of the specified remote ftp command.
ftpcommand not specified:
You are shown a list of all the ftp commands known on the remote
system. The commands are displayed in the form recognized by the
FTP daemon, e.g. CWD and not cd.
rename remotefile1 remotefile2
Renames a remote file from remotefile1 to remotefile2.
reset
Clears the reply queue.
reset resynchronizes command/reply sequencing with the FTP dae-
mon. This may be necessary if the FTP protocol has been violated
by the remote daemon.
rmdir dir
Deletes the directory dir from the remote system.
runique
Toggles storing of files on the local system with unique names.
Default: off. This only affects files that you transfer with get,
mget or recv. If there are files in the current local directory
with the same names as the files you are transferring, the trans-
ferred files are given a suffix between .1 and .98 if runique is
set to on. When .99 is reached, an error message is issued to
inform you that the last renaming did not take place. runique
then displays the last name assigned.
Page 22 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
send localfile [remotefile]
Retrieves the specified file from the local system and stores it
on the remote system under the name remotefile (see put).
sendport
Toggles the use of PORT commands. Default: on. These are commands
of the daemon processes (see remotehelp). This function may be of
use for communication with non-Siemens Nixdorf systems.
When the function is on, ftp attempts to use a PORT command when
setting up a connection for each file transfer. If the command
fails, ftp uses the default data port.
When the function is off, PORT commands cannot be used. This is
useful with ftp implementations that ignore PORT commands but
incorrectly report that they have been accepted.
status
Shows which toggle functions are currently on or off on the local
system, what values are set and which macros are defined.
struct [file]
Sets the file structure to file. This structure is set by
default. For this reason, using this command always produces the
following message:
We only support file structure, sorry.
sunique
Toggles storing of files on the remote system with unique names.
Default: off. This only affects files that you transfer with put,
mput or send. If there are files in the current remote directory
that have the same name as the files being transferred, the
transferred files are given a suffix between .1 and .98 if
sunique is set to on. When .99 is reached, an error message is
issued to inform you that the last renaming did not take place.
sunique then displays the last name assigned.
tenex
Changes the file transfer type to that needed to communicate with
TENEX systems. You use tenex to communicate with DEC PDP-10 and
PDP-20 systems that work with different byte lengths.
trace
Toggles packet tracing (currently not implemented).
type [type]
Sets the file transfer type to type. Default: ascii. type may be
binary (image), ascii or tenex. tenex is suitable for a local
byte size of 8 bits (needed to communicate with TENEX systems).
Page 23 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
type not specified:
ftp displays the current transfer type.
user loginname [password] [account]
Logs in on a remote system as user. You need this command if you
have already set up a connection to a remote system but do not
yet have a connection to a login name, e.g. you might have called
ftp with the -n option and specified a system name.
If you do not specify a password, you will be prompted for one.
An account is not required unless you want to communicate with
systems that work with account numbers.
verbose
Toggles verbose mode. Default: on. When this function is on, ver-
bose displays all responses from the ftp daemon and logs the pro-
gress of the file transfer on the screen.
Conventions for local file names
1. If you use a dash as the local file name, standard input is used
for reading and standard output for writing.
2. If the first character of a file name argument is the pipe symbol
|, the rest of the name is interpreted as a shell command. An argu-
ment containing a blank must be entered in double quotes, e.g.: dir
. "| pg"
3. If file name expansion (globbing) is enabled, the local file names
are expanded in accordance with the rules of the Bourne shell sh
(see the -g option and the ftp glob command).
4. If mget or get is specified without a local file name, the files
transferred are given the same names as they have on the remote
system unless you enabled one of the functions case, nmap, ntrans
or runique before starting the transfer.
5. Likewise, the remote file name is the same as the local file name
if you do not specify a remote file name in put or if you transfer
files using mput. You can also change this mechanism before start-
ing the transfer using one or more of the functions case, nmap,
ntrans and sunique.
Aborting a file transfer
You can abort a file transfer using the interrupt key on your key-
board, e.g. <DEL>, or the shell command kill.
Aborting with <DEL>
The response to the <DEL> key depends on
Page 24 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
- whether you started the transfer with mget, mput, get or put
- whether the prompt function is on
- whether and how the ABOR command is supported by the remote daemon
The messages are self-explanatory.
If you press <DEL> to interrupt a transfer started with mget or mput
and prompt is on, you will be asked whether you want to continue or
not. Entering n causes the transfer to be aborted. Pressing <RETURN>
causes the transfer to be resumed with the next file. In either case,
the file being processed when you pressed <DEL> is not transferred.
Aborting with kill
The abort signal sent by <DEL> is ignored if ftp has already ter-
minated all work on the local system and is waiting for a response
from the daemon on the remote system.
A long delay in this mode results either from the processing of the
ABOR command by the remote daemon or from unexpected daemon behavior.
In the latter instance, the local ftp process must be aborted with the
kill shell command.
File transfer parameters
FTP defines a number of parameters that may affect file transfers. It
is possible to transfer files over a network with various types of
character representation: ASCII, EBCDIC, image or a locally defined
byte size of 8 (primarily for PDP-10s and PDP-20s). In the case of the
ASCII and EBCDIC types, further subtypes specify whether characters
that control the vertical file format (e.g. newline characters) are
passed through or converted to TELNET or ASA format.
ftp supports the ASCII representation type and the locally defined
byte sizes (8 bit) for communication with TENEX systems.
There are three types of file structure:
- file (no records)
- record
- page
ftp supports only the default value, file.
Page 25 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
The transfer mode may be:
- stream
- block
- compressed
ftp supports only the default value, stream.
The .netrc file
When you enter ftp or the ftp open command together with the name of a
remote system, the .netrc file is located and processed. It contains
data required for the login on the remote system in file transfers
with ftp. It must be located in the user's home directory on the local
system and have the access permissions -rw-------, since it may
include passwords (see password and Example 2 below).
The login data is specified in the form of tokens and their values.
Each token may be specified more than once. Token and value must be
separated from each other and from the next token by blanks, tabs or
newline characters. The following tokens are available:
machine remotesystem
identifies the system to or from which you want to transfer
files. If remotesystem matches the argument in the ftp call or
in the open command, all the other tokens are processed.
login loginname
identifies the login name on the remote system.
password password
supplies a password for loginname.
When this token is present, ftp aborts the auto-login process if
the .netrc file is readable by anyone besides the owner.
account password2
supplies an additional password (also refer to the ftp account
command).
macdef macroname
defines a macro (see the ftp macdef command). If you name the
macro init, macdef is processed as the last token.
ERROR MESSAGES
The error messages that ftp issues are self-explanatory.
Page 26 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
EXAMPLES
Example 1
Example for using a .netrc file
User jane often transfers files to the two systems bogart and sam. So
she creates a .netrc which automatically logs her in on the system
that she specifies when calling ftp. When she logs in on bogart, vari-
ous preliminary functions are performed automatically by the init
macro. Each command must be on a separate line in the macro defini-
tion, which must be terminated by two consecutive newline characters.
The file contains two passwords and is thus assigned read and write
permission for the user only (chmod).
cat > .netrc
machine bogart login jane password wrdl.brm
macdef init
verbose
prompt
runique
sunique <RETURN>
<RETURN>
machine sam login jane password thundery
<CTRL-D>
chmod go-rw .netrc
Example 2
User jane specifies the system sam and is automatically logged in
there (see first example). She changes directory there (cd) and lists
the contents of the new current directory (ls). The files are to be
transferred to the system bogart (proxy open ...). Since the .netrc
file is not executed by proxy, jane logs in explicitly. The files are
to have new names on bogart (proxy nmap ...). jane then creates a new
directory on the local system (!, mkdir), changes to that directory
(lcd) and transfers the files from sam to the local system (mget)
without prompts for confirmation (prompt).
In this example, all message output has been omitted, other outputs
abbreviated and blank lines inserted for the sake of clarity.
ftp sam
ftp> cd MANUAL
ftp> pwd
/home2/jane/MANUAL
ftp> ls -x
OM.graphics OM.chap.1 OM.chap.2 OM.chap.3
Page 27 Reliant UNIX 5.44 Printed 11/98
ftp(1) ftp(1)
ftp> proxy open bogart
Name: jane
Password: secret
ftp> proxy nmap $1.$2.$3 $2.[$3,om]
ftp> proxy cd OM
ftp> proxy mget OM.*
ftp> proxy ls -x
graphics.om chap.1 chap.2 chap.3
ftp> proxy close
ftp> !
$ mkdir VERSION2
$ <CTRL-D>
ftp> lcd VERSION2
ftp> prompt
ftp> mget OM.*
ftp> bye
$
FILES
/usr/adm/wtmp
contains records of all system logins
SEE ALSO
ls(1), rcp(1), sh(1), tar(1), tftp(1), ftpd(1M), popen(3S), netrc(4).
Page 28 Reliant UNIX 5.44 Printed 11/98