143083Scael.\" Copyright (c) 1985, 1989, 1990 The Regents of the University of California. 235630Sbostic.\" All rights reserved. 319706Smckusick.\" 443083Scael.\" %sccs.include.redist.man% 519706Smckusick.\" 6*44954Scael.\" @(#)ftp.1 6.15 (Berkeley) 07/24/90 735630Sbostic.\" 843083Scael.Dd 943083Scael.Dt FTP 1 1043083Scael.Os BSD 4.2 1143083Scael.Sh NAME 1243083Scael.Nm ftp 1343083Scael.Nd ARPANET file transfer program 1443083Scael.Sh SYNOPSIS 1543083Scael.Nm ftp 1643083Scael.Op Fl v 1743083Scael.Op Fl d 1843083Scael.Op Fl i 1943083Scael.Op Fl n 2043083Scael.Op Fl g 2143083Scael.Op Ar host 2243083Scael.Sh DESCRIPTION 2343083Scael.Nm Ftp 2419706Smckusickis the user interface to the ARPANET standard File Transfer Protocol. 2526050SminshallThe program allows a user to transfer files to and from a 2626050Sminshallremote network site. 2743083Scael.Pp 2843083ScaelOptions may be specified at the command line, or to the 2943083Scaelcommand interpreter. 30*44954Scael.Tw Ds 3143083Scael.Tp Fl v 3243083ScaelVerbose option forces 3343083Scael.Nm ftp 3443083Scaelto show all responses from the remote server, as well 3543083Scaelas report on data transfer statistics. 3643083Scael.Tp Fl n 3743083ScaelRestrains 3843083Scael.Nm ftp 3943083Scaelfrom attempting \*(Lqauto-login\*(Rq upon initial connection. 4043083ScaelIf auto-login is enabled, 4143083Scael.Nm ftp 4243083Scaelwill check the 4343083Scael.Pa .netrc 4443083Scael(see below) file in the user's home directory for an entry describing 4543083Scaelan account on the remote machine. If no entry exists, 4643083Scael.Nm ftp 4743083Scaelwill prompt for the remote machine login name (default is the user 4843083Scaelidentity on the local machine), and, if necessary, prompt for a password 4943083Scaeland an account with which to login. 5043083Scael.Tp Fl i 5143083ScaelTurns off interactive prompting during 5243083Scaelmultiple file transfers. 5343083Scael.Tp Fl d 5443083ScaelEnables debugging. 5543083Scael.Tp Fl g 5643083ScaelDisables file name globbing. 5743083Scael.Tp 5843083Scael.Pp 5943083ScaelThe client host with which 6043083Scael.Nm ftp 6119706Smckusickis to communicate may be specified on the command line. 6219706SmckusickIf this is done, 6343083Scael.Nm ftp 6426050Sminshallwill immediately attempt to establish a connection to an FTP 6543083Scaelserver on that host; otherwise, 6643083Scael.Nm ftp 6726050Sminshallwill enter its command interpreter and await instructions 6843083Scaelfrom the user. When 6943083Scael.Nm ftp 70*44954Scaelis awaiting commands from the user the prompt 71*44954Scael.Ql ftp> 7228002Sanneis provided to the user. The following commands are recognized 7319706Smckusickby 7443083Scael.Nm ftp : 7543083Scael.Tw Fl 7643083Scael.Tp Cx Ic \&! 77*44954Scael.Ws 7843083Scael.Op Ar command Op Ar args 7943083Scael.Cx 8026050SminshallInvoke an interactive shell on the local machine. 8126050SminshallIf there are arguments, the first is taken to be a command to execute 8226050Sminshalldirectly, with the rest of the arguments as its arguments. 8343083Scael.Tp Cx Ic \&$ 84*44954Scael.Ws 8543083Scael.Ar macro-name 8643083Scael.Op Ar args 8743083Scael.Cx 8843083ScaelExecute the macro 8943083Scael.Ar macro-name 9043083Scaelthat was defined with the 9143083Scael.Ic macdef 9243083Scaelcommand. 9326050SminshallArguments are passed to the macro unglobbed. 9443083Scael.Tp Cx Ic account 95*44954Scael.Ws 9643083Scael.Op Ar passwd 9743083Scael.Cx 9826050SminshallSupply a supplemental password required by a remote system for access 9926050Sminshallto resources once a login has been successfully completed. 10026050SminshallIf no argument is included, the user will be prompted for an account 10126050Sminshallpassword in a non-echoing input mode. 10243083Scael.Tp Cx Ic append 103*44954Scael.Ws 10443083Scael.Ar local-file 105*44954Scael.Ws 10643083Scael.Op Ar remote-file 10743083Scael.Cx 10819706SmckusickAppend a local file to a file on the remote machine. If 10943083Scael.Ar remote-file 11019706Smckusickis left unspecified, the local file name is used in naming the 11126050Sminshallremote file after being altered by any 11243083Scael.Ic ntrans 11326050Sminshallor 11443083Scael.Ic nmap 11526050Sminshallsetting. 11626050SminshallFile transfer uses the current settings for 11743083Scael.Ic type , 11843083Scael.Ic format , 11943083Scael.Ic mode , 12026050Sminshalland 121*44954Scael.Ic structure . 12243083Scael.Tp Ic ascii 12343083ScaelSet the file transfer 12443083Scael.Ic type 12526050Sminshallto network ASCII. This is the default type. 12643083Scael.Tp Ic bell 12719706SmckusickArrange that a bell be sounded after each file transfer 12819706Smckusickcommand is completed. 12943083Scael.Tp Ic binary 13026050SminshallSet the file transfer 13143083Scael.Ic type 13226050Sminshallto support binary image transfer. 13343083Scael.Tp Ic bye 13419706SmckusickTerminate the FTP session with the remote server 13519706Smckusickand exit 13643083Scael.Nm ftp . 13726085SlepreauAn end of file will also terminate the session and exit. 13843083Scael.Tp Ic case 13926050SminshallToggle remote computer file name case mapping during 14043083Scael.Ic mget 14126050Sminshallcommands. 14226050SminshallWhen 14343083Scael.Ic case 14426050Sminshallis on (default is off), remote computer file names with all letters in 14526050Sminshallupper case are written in the local directory with the letters mapped 14626050Sminshallto lower case. 14743083Scael.Tp Cx Ic cd 148*44954Scael.Ws 14943083Scael.Ar remote-directory 15043083Scael.Cx 15119706SmckusickChange the working directory on the remote machine 15243083Scaelto 15343083Scael.Ar remote-directory . 15443083Scael.Tp Ic cdup 15526050SminshallChange the remote machine working directory to the parent of the 15626050Sminshallcurrent remote machine working directory. 15743083Scael.Tp Cx Ic chmod 158*44954Scael.Ws 15943083Scael.Ar mode file-name 16043083Scael.Cx 161*44954ScaelChange the permission modes of the file 16243083Scael.Ar file-name 16343083Scaelon the remote 16443083Scaelsytem to 165*44954Scael.Ar mode . 16643083Scael.Tp Ic close 16719706SmckusickTerminate the FTP session with the remote server, and 16819706Smckusickreturn to the command interpreter. 16926050SminshallAny defined macros are erased. 17043083Scael.Tp Ic cr 17126050SminshallToggle carriage return stripping during 17226050Sminshallascii type file retrieval. 17326050SminshallRecords are denoted by a carriage return/linefeed sequence 17426050Sminshallduring ascii type file transfer. 17526050SminshallWhen 17643083Scael.Ic cr 17726050Sminshallis on (the default), carriage returns are stripped from this 17826050Sminshallsequence to conform with the UNIX single linefeed record 17926050Sminshalldelimiter. 18026050SminshallRecords on non-UNIX remote systems may contain single linefeeds; 18126050Sminshallwhen an ascii type transfer is made, these linefeeds may be 18226050Sminshalldistinguished from a record delimiter only when 18343083Scael.Ic cr 18426050Sminshallis off. 18543083Scael.Tp Cx Ic delete 186*44954Scael.Ws 18743083Scael.Ar remote-file 18843083Scael.Cx 18919706SmckusickDelete the file 19043083Scael.Ar remote-file 19119706Smckusickon the remote machine. 19243083Scael.Tp Cx Ic debug 193*44954Scael.Ws 19443083Scael.Op Ar debug-value 19543083Scael.Cx 19619706SmckusickToggle debugging mode. If an optional 19743083Scael.Ar debug-value 19819706Smckusickis specified it is used to set the debugging level. 19919706SmckusickWhen debugging is on, 20043083Scael.Nm ftp 20119706Smckusickprints each command sent to the remote machine, preceded 202*44954Scaelby the string 203*44954Scael.Ql \-\-> 20443083Scael.Tp Cx Ic dir 205*44954Scael.Ws 20643083Scael.Op Ar remote-directory 207*44954Scael.Ws 20843083Scael.Op Ar local-file 20943083Scael.Cx 21019706SmckusickPrint a listing of the directory contents in the 21119706Smckusickdirectory, 21243083Scael.Ar remote-directory , 21319706Smckusickand, optionally, placing the output in 21443083Scael.Ar local-file . 21532345SbosticIf interactive prompting is on, 21643083Scael.Nm ftp 21732345Sbosticwill prompt the user to verify that the last argument is indeed the 21832345Sbostictarget local file for receiving 21943083Scael.Ic dir 22032345Sbosticoutput. 22119706SmckusickIf no directory is specified, the current working 22219706Smckusickdirectory on the remote machine is used. If no local 22343083Scaelfile is specified, or 22443083Scael.Ar local-file 22543083Scaelis 22643083Scael.Fl , 22719707Smckusickoutput comes to the terminal. 22843083Scael.Tp Ic disconnect 22926050SminshallA synonym for 23043083Scael.Ar close . 23143083Scael.Tp Cx Ic form 232*44954Scael.Ws 23343083Scael.Ar format 23443083Scael.Cx 23543083ScaelSet the file transfer 23643083Scael.Ic form 23743083Scaelto 23843083Scael.Ar format . 23943083ScaelThe default format is \*(Lqfile\*(Rq. 24043083Scael.Tp Cx Ic get 241*44954Scael.Ws 24243083Scael.Ar remote-file 243*44954Scael.Ws 24443083Scael.Op Ar local-file 24543083Scael.Cx 24643083ScaelRetrieve the 24743083Scael.Ar remote-file 24819706Smckusickand store it on the local machine. If the local 24919706Smckusickfile name is not specified, it is given the same 25026050Sminshallname it has on the remote machine, subject to 25126050Sminshallalteration by the current 25243083Scael.Ic case , 25343083Scael.Ic ntrans , 25426050Sminshalland 25543083Scael.Ic nmap 25626050Sminshallsettings. 25743083ScaelThe current settings for 25843083Scael.Ic type , 25943083Scael.Ic form , 26043083Scael.Ic mode , 26126050Sminshalland 26243083Scael.Ic structure 26319706Smckusickare used while transferring the file. 26443083Scael.Tp Ic glob 26543083ScaelToggle filename expansion for 26643083Scael.Ic mdelete , 26743083Scael.Ic mget 26843083Scaeland 26943083Scael.Ic mput . 27043083ScaelIf globbing is turned off with 27143083Scael.Ic glob , 27243083Scaelthe file name arguments 27326050Sminshallare taken literally and not expanded. 27443083ScaelGlobbing for 27543083Scael.Ic mput 27643083Scaelis done as in 27743083Scael.Xr csh 1 . 27843083ScaelFor 27943083Scael.Ic mdelete 28043083Scaeland 28143083Scael.Ic mget , 28243083Scaeleach remote file name is expanded 28326050Sminshallseparately on the remote machine and the lists are not merged. 28443083ScaelExpansion of a directory name is likely to be 28519707Smckusickdifferent from expansion of the name of an ordinary file: 28626050Sminshallthe exact result depends on the foreign operating system and ftp server, 28743083Scaeland can be previewed by doing 288*44954Scael.Ql mls remote-files \- 28943083ScaelNote: 29043083Scael.Ic mget 29143083Scaeland 29243083Scael.Ic mput 29343083Scaelare not meant to transfer 29426050Sminshallentire directory subtrees of files. That can be done by 29543083Scaeltransferring a 29643083Scael.Xr tar 1 29743083Scaelarchive of the subtree (in binary mode). 29843083Scael.Tp Ic hash 29919706SmckusickToggle hash-sign (``#'') printing for each data block 30019706Smckusicktransferred. The size of a data block is 1024 bytes. 30143083Scael.Tp Cx Ic help 302*44954Scael.Ws 30343083Scael.Op Ar command 30443083Scael.Cx 30519706SmckusickPrint an informative message about the meaning of 30643083Scael.Ar command . 30743083ScaelIf no argument is given, 30843083Scael.Nm ftp 30919706Smckusickprints a list of the known commands. 31043083Scael.Tp Cx Ic idle 311*44954Scael.Ws 31243083Scael.Op Ar seconds 31343083Scael.Cx 31443083ScaelSet the inactivity timer on the remote server to 31543083Scael.Ar seconds 31643083Scaelseconds. 31743083ScaelIf 31843083Scael.Ar seconds 31943083Scaelis ommitted, the current inactivity timer is printed. 32043083Scael.Tp Cx Ic lcd 321*44954Scael.Ws 32243083Scael.Op Ar directory 32343083Scael.Cx 32419706SmckusickChange the working directory on the local machine. If 32543083Scaelno 32643083Scael.Ar directory 32719706Smckusickis specified, the user's home directory is used. 32843083Scael.Tp Cx Ic ls 329*44954Scael.Ws 33043083Scael.Op Ar remote-directory 331*44954Scael.Ws 33243083Scael.Op Ar local-file 33343083Scael.Cx 33436935SkarelsPrint a listing of the contents of a 33536940Skarelsdirectory on the remote machine. 33636940SkarelsThe listing includes any system-dependent information that the server 33736940Skarelschooses to include; for example, most UNIX systems will produce 338*44954Scaeloutput from the command 339*44954Scael.Ql ls \-l . 34043083Scael(See also 34143083Scael.Ic nlist . 34243083Scael) 34336940SkarelsIf 34443083Scael.Ar remote-directory 34532345Sbosticis left unspecified, the current working directory is used. 34632345SbosticIf interactive prompting is on, 34743083Scael.Nm ftp 34832345Sbosticwill prompt the user to verify that the last argument is indeed the 34932345Sbostictarget local file for receiving 35043083Scael.Ic ls 35132345Sbosticoutput. 35243083ScaelIf no local file is specified, or if 35343083Scael.Ar local-file 35443083Scaelis 355*44954Scael.Sq Fl , 35619707Smckusickthe output is sent to the terminal. 35743083Scael.Tp Cx Ic macdef 358*44954Scael.Ws 35943083Scael.Ar macro-name 36043083Scael.Cx 36126050SminshallDefine a macro. 36226050SminshallSubsequent lines are stored as the macro 36343083Scael.Ar macro-name ; 36443083Scaela null line (consecutive newline characters 36526050Sminshallin a file or 36626050Sminshallcarriage returns from the terminal) terminates macro input mode. 36726050SminshallThere is a limit of 16 macros and 4096 total characters in all 36826050Sminshalldefined macros. 36926050SminshallMacros remain defined until a 37043083Scael.Ic close 37126050Sminshallcommand is executed. 372*44954ScaelThe macro processor interprets `$' and `\e' as special characters. 373*44954ScaelA `$' followed by a number (or numbers) is replaced by the 37426050Sminshallcorresponding argument on the macro invocation command line. 375*44954ScaelA `$' followed by an `i' signals that macro processor that the 376*44954Scaelexecuting macro is to be looped. On the first pass `$i' is 37726050Sminshallreplaced by the first argument on the macro invocation command line, 37826050Sminshallon the second pass it is replaced by the second argument, and so on. 379*44954ScaelA `\e' followed by any character is replaced by that character. 380*44954ScaelUse the `\e' to prevent special treatment of the `$'. 38143083Scael.Tp Cx Ic mdelete 382*44954Scael.Ws 38343083Scael.Op Ar remote-files 38443083Scael.Cx 38543083ScaelDelete the 38643083Scael.Ar remote-files 38743083Scaelon the remote machine. 38843083Scael.Tp Cx Ic mdir 389*44954Scael.Ws 39043083Scael.Ar remote-files 391*44954Scael.Ws 39243083Scael.Ar local-file 39343083Scael.Cx 39443083ScaelLike 39543083Scael.Ic dir , 39643083Scaelexcept multiple remote files may be specified. 39726050SminshallIf interactive prompting is on, 39843083Scael.Nm ftp 39926050Sminshallwill prompt the user to verify that the last argument is indeed the 40026050Sminshalltarget local file for receiving 40143083Scael.Ic mdir 40226050Sminshalloutput. 40343083Scael.Tp Cx Ic mget 404*44954Scael.Ws 40543083Scael.Ar remote-files 40643083Scael.Cx 40743083ScaelExpand the 40843083Scael.Ar remote-files 40943083Scaelon the remote machine 41043083Scaeland do a 41143083Scael.Ic get 41243083Scaelfor each file name thus produced. 41343083ScaelSee 41443083Scael.Ic glob 41543083Scaelfor details on the filename expansion. 41626050SminshallResulting file names will then be processed according to 41743083Scael.Ic case , 41843083Scael.Ic ntrans , 41926050Sminshalland 42043083Scael.Ic nmap 42126050Sminshallsettings. 42219707SmckusickFiles are transferred into the local working directory, 42343083Scaelwhich can be changed with 42443083Scael.Cx ` 42543083Scael.Cx Li lcd directory 42643083Scael.Cx \'; 42743083Scaelnew local directories can be created with 42843083Scael.Cx Li \&! mkdir directory 42943083Scael.Cx \'. 43043083Scael.Tp Cx Ic mkdir 431*44954Scael.Ws 43243083Scael.Ar directory-name 43343083Scael.Cx 43419706SmckusickMake a directory on the remote machine. 43543083Scael.Tp Cx Ic mls 436*44954Scael.Ws 43743083Scael.Ar remote-files 438*44954Scael.Ws 43943083Scael.Ar local-file 44043083Scael.Cx 44143083ScaelLike 44243083Scael.Ic nlist , 44343083Scaelexcept multiple remote files may be specified, 44443083Scaeland the 44543083Scael.Ar local-file 44643083Scaelmust be specified. 44726050SminshallIf interactive prompting is on, 44843083Scael.Nm ftp 44926050Sminshallwill prompt the user to verify that the last argument is indeed the 45026050Sminshalltarget local file for receiving 45143083Scael.Ic mls 45226050Sminshalloutput. 45343083Scael.Tp Cx Ic mode 454*44954Scael.Ws 45543083Scael.Op Ar mode-name 45643083Scael.Cx 45726050SminshallSet the file transfer 45843083Scael.Ic mode 45926050Sminshallto 46043083Scael.Ar mode-name . 46143083ScaelThe default mode is \*(Lqstream\*(Rq mode. 46243083Scael.Tp Cx Ic modtime 463*44954Scael.Ws 46443083Scael.Ar file-name 46543083Scael.Cx 46636935SkarelsShow the last modification time of the file on the remote machine. 46743083Scael.Tp Cx Ic mput 468*44954Scael.Ws 46943083Scael.Ar local-files 47043083Scael.Cx 47119707SmckusickExpand wild cards in the list of local files given as arguments 47243083Scaeland do a 47343083Scael.Ic put 47443083Scaelfor each file in the resulting list. 47543083ScaelSee 47643083Scael.Ic glob 47743083Scaelfor details of filename expansion. 47826050SminshallResulting file names will then be processed according to 47943083Scael.Ic ntrans 48026050Sminshalland 48143083Scael.Ic nmap 48226050Sminshallsettings. 48343083Scael.Tp Cx Ic newer 484*44954Scael.Ws 48543083Scael.Ar file-name 48643083Scael.Cx 48737224SkarelsGet the file only if the modification time of the remote file is more 48837224Skarelsrecent that the file on the current system. If the file does not 48943083Scaelexist on the current system, the remote file is considered 49043083Scael.Ic newer . 49143083ScaelOtherwise, this command is identical to 49243083Scael.Ar get . 49343083Scael.Tp Cx Ic nlist 494*44954Scael.Ws 49543083Scael.Op Ar remote-directory 496*44954Scael.Ws 49743083Scael.Op Ar local-file 49843083Scael.Cx 499*44954ScaelPrint a list of the files in a 50036935Skarelsdirectory on the remote machine. If 50143083Scael.Ar remote-directory 50236935Skarelsis left unspecified, the current working directory is used. 50336935SkarelsIf interactive prompting is on, 50443083Scael.Nm ftp 50536935Skarelswill prompt the user to verify that the last argument is indeed the 50636935Skarelstarget local file for receiving 50743083Scael.Ic nlist 50836935Skarelsoutput. 50943083ScaelIf no local file is specified, or if 51043083Scael.Ar local-file 51143083Scaelis 51243083Scael.Fl , 51336935Skarelsthe output is sent to the terminal. 51443083Scael.Tp Cx Ic nmap 515*44954Scael.Ws 51643083Scael.Op Ar inpattern outpattern 51743083Scael.Cx 51826050SminshallSet or unset the filename mapping mechanism. 51926050SminshallIf no arguments are specified, the filename mapping mechanism is unset. 52026050SminshallIf arguments are specified, remote filenames are mapped during 52143083Scael.Ic mput 52226050Sminshallcommands and 52343083Scael.Ic put 52426050Sminshallcommands issued without a specified remote target filename. 52526050SminshallIf arguments are specified, local filenames are mapped during 52643083Scael.Ic mget 52726050Sminshallcommands and 52843083Scael.Ic get 52926050Sminshallcommands issued without a specified local target filename. 53026050SminshallThis command is useful when connecting to a non-UNIX remote computer 53126050Sminshallwith different file naming conventions or practices. 53226050SminshallThe mapping follows the pattern set by 53343083Scael.Ar inpattern 53426050Sminshalland 53543083Scael.Ar outpattern . 53643083Scael.Op Ar Inpattern 53726050Sminshallis a template for incoming filenames (which may have already been 53826050Sminshallprocessed according to the 53943083Scael.Ic ntrans 54026050Sminshalland 54143083Scael.Ic case 54226050Sminshallsettings). 543*44954ScaelVariable templating is accomplished by including the sequences `$1', `$2', ..., `$9' in 54443083Scael.Ar inpattern . 545*44954ScaelUse `\\' to prevent this special treatment of the `$' character. 54626050SminshallAll other characters are treated literally, and are used to determine the 54743083Scael.Ic nmap 54843083Scael.Op Ar inpattern 54926050Sminshallvariable values. 55036935SkarelsFor example, given 55143083Scael.Ar inpattern 55226050Sminshall$1.$2 and the remote file name "mydata.data", $1 would have the value 55326050Sminshall"mydata", and $2 would have the value "data". 55426050SminshallThe 55543083Scael.Ar outpattern 55626050Sminshalldetermines the resulting mapped filename. 557*44954ScaelThe sequences `$1', `$2', ...., `$9' are replaced by any value resulting 55826050Sminshallfrom the 55943083Scael.Ar inpattern 56026050Sminshalltemplate. 561*44954ScaelThe sequence `$0' is replace by the original filename. 56243083ScaelAdditionally, the sequence 56343083Scael.Cx ` 56443083Scael.Op Ar seq1 , Ar seq2 56543083Scael.Cx \' 566*44954Scael.Cx 56743083Scaelis replaced by 56843083Scael.Op Ar seq1 56926050Sminshallif 57043083Scael.Ar seq1 57126050Sminshallis not a null string; otherwise it is replaced by 57243083Scael.Ar seq2 . 57343083ScaelFor example, the command 57443083Scael.Pp 57543083Scael.Df I 57643083Scaelnmap $1.$2.$3 57743083Scael.Cx Op $1,$2 57843083Scael.Cx . 57943083Scael.Op $2,file 58043083Scael.Cx 58143083Scael.De 58243083Scael.Pp 58343083Scaelwould yield 58426050Sminshallthe output filename "myfile.data" for input filenames "myfile.data" and 58526050Sminshall"myfile.data.old", "myfile.file" for the input filename "myfile", and 58626050Sminshall"myfile.myfile" for the input filename ".myfile". 58726050SminshallSpaces may be included in 58843083Scael.Ar outpattern , 589*44954Scaelas in the example: `nmap $1 sed "s/ *$//" > $1' . 590*44954ScaelUse the `\e' character to prevent special treatment 591*44954Scaelof the `$','[','[', and `,' characters. 59243083Scael.Tp Cx Ic ntrans 593*44954Scael.Ws 59443083Scael.Op Ar inchars Op Ar outchars 59543083Scael.Cx 59626050SminshallSet or unset the filename character translation mechanism. 59726050SminshallIf no arguments are specified, the filename character 59826050Sminshalltranslation mechanism is unset. 59926050SminshallIf arguments are specified, characters in 60026050Sminshallremote filenames are translated during 60143083Scael.Ic mput 60226050Sminshallcommands and 60343083Scael.Ic put 60426050Sminshallcommands issued without a specified remote target filename. 60526050SminshallIf arguments are specified, characters in 60626050Sminshalllocal filenames are translated during 60743083Scael.Ic mget 60826050Sminshallcommands and 60943083Scael.Ic get 61026050Sminshallcommands issued without a specified local target filename. 61126050SminshallThis command is useful when connecting to a non-UNIX remote computer 61226050Sminshallwith different file naming conventions or practices. 61326050SminshallCharacters in a filename matching a character in 61443083Scael.Ar inchars 61526050Sminshallare replaced with the corresponding character in 61643083Scael.Ar outchars . 61726050SminshallIf the character's position in 61843083Scael.Ar inchars 61926050Sminshallis longer than the length of 62043083Scael.Ar outchars , 62126050Sminshallthe character is deleted from the file name. 62243083Scael.Tp Cx Ic open 623*44954Scael.Ws 62443083Scael.Ar host 625*44954Scael.Ws 62643083Scael.Op Ar port 62743083Scael.Cx 62819706SmckusickEstablish a connection to the specified 62943083Scael.Ar host 63019706SmckusickFTP server. An optional port number may be supplied, 63143083Scaelin which case, 63243083Scael.Nm ftp 63319706Smckusickwill attempt to contact an FTP server at that port. 63443083ScaelIf the 63543083Scael.Ic auto-login 63643083Scaeloption is on (default), 63743083Scael.Nm ftp 63819706Smckusickwill also attempt to automatically log the user in to 63919706Smckusickthe FTP server (see below). 64043083Scael.Tp Ic prompt 64119706SmckusickToggle interactive prompting. Interactive prompting 64219706Smckusickoccurs during multiple file transfers to allow the 64319707Smckusickuser to selectively retrieve or store files. 64443083ScaelIf prompting is turned off (default is on), any 64543083Scael.Ic mget 64643083Scaelor 64743083Scael.Ic mput 64843083Scaelwill transfer all files, and any 64943083Scael.Ic mdelete 65043083Scaelwill delete all files. 65143083Scael.Tp Cx Ic proxy 652*44954Scael.Ws 65343083Scael.Ar ftp-command 65443083Scael.Cx 65526050SminshallExecute an ftp command on a secondary control connection. 65626050SminshallThis command allows simultaneous connection to two remote ftp 65726050Sminshallservers for transferring files between the two servers. 65826050SminshallThe first 65943083Scael.Ic proxy 66026050Sminshallcommand should be an 66143083Scael.Ic open , 66226050Sminshallto establish the secondary control connection. 66326050SminshallEnter the command "proxy ?" to see other ftp commands executable on the 66426050Sminshallsecondary connection. 66527895SkarelsThe following commands behave differently when prefaced by 66643083Scael.Ic proxy : 66743083Scael.Ic open 66826050Sminshallwill not define new macros during the auto-login process, 66943083Scael.Ic close 67026050Sminshallwill not erase existing macro definitions, 67143083Scael.Ic get 67226050Sminshalland 67343083Scael.Ic mget 67426050Sminshalltransfer files from the host on the primary control connection 67526050Sminshallto the host on the secondary control connection, and 67643083Scael.Ic put , 67743083Scael.Ic mput , 67826050Sminshalland 67943083Scael.Ic append 68026050Sminshalltransfer files from the host on the secondary control connection 68126050Sminshallto the host on the primary control connection. 68226050SminshallThird party file transfers depend upon support of the ftp protocol 68326050SminshallPASV command by the server on the secondary control connection. 68443083Scael.Tp Cx Ic put 685*44954Scael.Ws 68643083Scael.Ar local-file 687*44954Scael.Ws 68843083Scael.Op Ar remote-file 68943083Scael.Cx 69043083ScaelStore a local file on the remote machine. If 69143083Scael.Ar remote-file 69219706Smckusickis left unspecified, the local file name is used 69326050Sminshallafter processing according to any 69443083Scael.Ic ntrans 69526050Sminshallor 69643083Scael.Ic nmap 69726050Sminshallsettings 69819706Smckusickin naming the remote file. File transfer uses the 69926050Sminshallcurrent settings for 70043083Scael.Ic type , 70143083Scael.Ic format , 70243083Scael.Ic mode , 70326050Sminshalland 70443083Scael.Ic structure . 70543083Scael.Tp Ic pwd 70619706SmckusickPrint the name of the current working directory on the remote 70719706Smckusickmachine. 70843083Scael.Tp Ic quit 70926085SlepreauA synonym for 71043083Scael.Ic bye . 71143083Scael.Tp Cx Ic quote 712*44954Scael.Ws 713*44954Scael.Ar arg1 arg2 ... 71443083Scael.Cx 71526050SminshallThe arguments specified are sent, verbatim, to the remote FTP 71626050Sminshallserver. 71743083Scael.Tp Cx Ic recv 718*44954Scael.Ws 71943083Scael.Ar remote-file 720*44954Scael.Ws 72143083Scael.Op Ar local-file 72243083Scael.Cx 72326050SminshallA synonym for get. 72443083Scael.Tp Cx Ic reget 725*44954Scael.Ws 72643083Scael.Ar remote-file 727*44954Scael.Ws 72843083Scael.Op Ar local-file 72943083Scael.Cx 73043083ScaelReget acts like get, except that if 73143083Scael.Ar local-file 73243083Scaelexists and is 73343083Scaelsmaller than 73443083Scael.Ar remote-file , 73543083Scael.Ar local-file 73643083Scaelis presumed to be 73743083Scaela partially transferred copy of 73843083Scael.Ar remote-file 73943083Scaeland the transfer 74037224Skarelsis continued from the apparent point of failure. This command 74137224Skarelsis useful when transferring very large files over networks that 74237224Skarelsare prone to dropping connections. 74343083Scael.Tp Cx Ic remotehelp 744*44954Scael.Ws 74543083Scael.Op Ar command-name 74643083Scael.Cx 74743083ScaelRequest help from the remote FTP server. If a 74843083Scael.Ar command-name 74919706Smckusickis specified it is supplied to the server as well. 75043083Scael.Tp Cx Ic remotestatus 751*44954Scael.Ws 75243083Scael.Op Ar file-name 75343083Scael.Cx 75443083ScaelWith no arguments, show status of remote machine. If 75543083Scael.Ar file-name 75643083Scaelis specified, show status of 75743083Scael.Ar file-name 75843083Scaelon remote machine. 75943083Scael.Tp Cx Ic rename 760*44954Scael.Ws 76143083Scael.Op Ar from 762*44954Scael.Ws 76343083Scael.Op Ar to 76443083Scael.Cx 76519706SmckusickRename the file 76643083Scael.Ar from 76726050Sminshallon the remote machine, to the file 76843083Scael.Ar to . 76943083Scael.Tp Ic reset 77026050SminshallClear reply queue. 77126050SminshallThis command re-synchronizes command/reply sequencing with the remote 77226050Sminshallftp server. 77336935SkarelsResynchronization may be necessary following a violation of the ftp protocol 77426050Sminshallby the remote server. 77543083Scael.Tp Cx Ic restart 776*44954Scael.Ws 77743083Scael.Ar marker 77843083Scael.Cx 77943083ScaelRestart the immediately following 78043083Scael.Ic get 78143083Scaelor 78243083Scael.Ic put 78343083Scaelat the 78443083Scaelindicated 78543083Scael.Ar marker . 78643083ScaelOn UNIX systems, marker is usually a byte 78737224Skarelsoffset into the file. 78843083Scael.Tp Cx Ic rmdir 789*44954Scael.Ws 79043083Scael.Ar directory-name 79143083Scael.Cx 79219706SmckusickDelete a directory on the remote machine. 79343083Scael.Tp Ic runique 79426050SminshallToggle storing of files on the local system with unique filenames. 79526050SminshallIf a file already exists with a name equal to the target 79626050Sminshalllocal filename for a 79743083Scael.Ic get 79826050Sminshallor 79943083Scael.Ic mget 80026491Sminshallcommand, a ".1" is appended to the name. 80126050SminshallIf the resulting name matches another existing file, 80226050Sminshalla ".2" is appended to the original name. 80326050SminshallIf this process continues up to ".99", an error 80426050Sminshallmessage is printed, and the transfer does not take place. 80526050SminshallThe generated unique filename will be reported. 80626050SminshallNote that 80743083Scael.Ic runique 80826050Sminshallwill not affect local files generated from a shell command 80926050Sminshall(see below). 81026050SminshallThe default value is off. 81143083Scael.Tp Cx Ic send 812*44954Scael.Ws 81343083Scael.Ar local-file 814*44954Scael.Ws 81543083Scael.Op Ar remote-file 81643083Scael.Cx 81726050SminshallA synonym for put. 81843083Scael.Tp Ic sendport 81943083ScaelToggle the use of PORT commands. By default, 82043083Scael.Nm ftp 82119706Smckusickwill attempt to use a PORT command when establishing 82226050Sminshalla connection for each data transfer. 82326050SminshallThe use of PORT commands can prevent delays 82426050Sminshallwhen performing multiple file transfers. If the PORT 82543083Scaelcommand fails, 82643083Scael.Nm ftp 82719706Smckusickwill use the default data port. When the use of PORT 82819706Smckusickcommands is disabled, no attempt will be made to use 82919706SmckusickPORT commands for each data transfer. This is useful 83026050Sminshallfor certain FTP implementations which do ignore PORT 83126050Sminshallcommands but, incorrectly, indicate they've been accepted. 83243083Scael.Tp Cx Ic site 833*44954Scael.Ws 83443083Scael.Ar arg1 arg2 ... 83543083Scael.Cx 83637224SkarelsThe arguments specified are sent, verbatim, to the remote FTP 83737224Skarelsserver as a SITE command. 83843083Scael.Tp Cx Ic size 839*44954Scael.Ws 84043083Scael.Ar file-name 84143083Scael.Cx 84243083ScaelReturn size of 84343083Scael.Ar file-name 84443083Scaelon remote machine. 84543083Scael.Tp Ic status 84619706SmckusickShow the current status of 84743083Scael.Nm ftp . 84843083Scael.Tp Cx Ic struct 849*44954Scael.Ws 85043083Scael.Op Ar struct-name 85143083Scael.Cx 85226050SminshallSet the file transfer 85343083Scael.Ar structure 85426050Sminshallto 855*44954Scael.Ar struct-name . 85643083ScaelBy default \*(Lqstream\*(Rq structure is used. 85743083Scael.Tp Ic sunique 85826050SminshallToggle storing of files on remote machine under unique file names. 85926050SminshallRemote ftp server must support ftp protocol STOU command for 86026050Sminshallsuccessful completion. 86126050SminshallThe remote server will report unique name. 86226050SminshallDefault value is off. 86343083Scael.Tp Ic system 86436935SkarelsShow the type of operating system running on the remote machine. 86543083Scael.Tp Ic tenex 86626050SminshallSet the file transfer type to that needed to 86719706Smckusicktalk to TENEX machines. 86843083Scael.Tp Ic trace 86926050SminshallToggle packet tracing. 87043083Scael.Tp Cx Ic type 871*44954Scael.Ws 87243083Scael.Op Ar type-name 87343083Scael.Cx 87426050SminshallSet the file transfer 87543083Scael.Ic type 87626050Sminshallto 87743083Scael.Ar type-name . 87819706SmckusickIf no type is specified, the current type 87926050Sminshallis printed. The default type is network ASCII. 88043083Scael.Tp Cx Ic umask 881*44954Scael.Ws 88243083Scael.Op Ar newmask 88343083Scael.Cx 88443083ScaelSet the default umask on the remote server to 885*44954Scael.Ar newmask . 88643083ScaelIf 887*44954Scael.Ar newmask 88843083Scaelis ommitted, the current umask is printed. 88943083Scael.Tp Cx Ic user 890*44954Scael.Ws 89143083Scael.Ar user-name 892*44954Scael.Ws 89343083Scael.Op Ar password 894*44954Scael.Ws 89543083Scael.Op Ar account 89643083Scael.Cx 89719706SmckusickIdentify yourself to the remote FTP server. If the 898*44954Scael.Ar password 899*44954Scaelis not specified and the server requires it, 90043083Scael.Nm ftp 90119706Smckusickwill prompt the user for it (after disabling local echo). 902*44954ScaelIf an 903*44954Scael.Ar account 904*44954Scaelfield is not specified, and the FTP server 90526050Sminshallrequires it, the user will be prompted for it. 906*44954ScaelIf an 907*44954Scael.Ar account 908*44954Scaelfield is specified, an account command will 90926050Sminshallbe relayed to the remote server after the login sequence 91026050Sminshallis completed if the remote server did not require it 91126050Sminshallfor logging in. 91226050SminshallUnless 91343083Scael.Nm ftp 91443083Scaelis invoked with \*(Lqauto-login\*(Rq disabled, this 91519706Smckusickprocess is done automatically on initial connection to 91619706Smckusickthe FTP server. 91743083Scael.Tp Ic verbose 91819706SmckusickToggle verbose mode. In verbose mode, all responses from 91919706Smckusickthe FTP server are displayed to the user. In addition, 92026050Sminshallif verbose is on, when a file transfer completes, statistics 92119706Smckusickregarding the efficiency of the transfer are reported. By default, 92226050Sminshallverbose is on. 92343083Scael.Tp Cx Ic ? 924*44954Scael.Ws 92543083Scael.Op Ar command 92643083Scael.Cx 92726050SminshallA synonym for help. 92843083Scael.Tp 92943083Scael.Pp 93019706SmckusickCommand arguments which have embedded spaces may be quoted with 931*44954Scaelquote `"' marks. 932*44954Scael.Sh ABORTING A FILE TRANSFER 93327895SkarelsTo abort a file transfer, use the terminal interrupt key 93426050Sminshall(usually Ctrl-C). 93526050SminshallSending transfers will be immediately halted. 93626050SminshallReceiving transfers will be halted by sending a ftp protocol ABOR 93726050Sminshallcommand to the remote server, and discarding any further data received. 93826050SminshallThe speed at which this is accomplished depends upon the remote 93926050Sminshallserver's support for ABOR processing. 940*44954ScaelIf the remote server does not support the ABOR command, an 941*44954Scael.Ql ftp> 94226050Sminshallprompt will not appear until the remote server has completed 94326050Sminshallsending the requested file. 94443083Scael.Pp 94526050SminshallThe terminal interrupt key sequence will be ignored when 94643083Scael.Nm ftp 94726050Sminshallhas completed any local processing and is awaiting a reply 94826050Sminshallfrom the remote server. 94926050SminshallA long delay in this mode may result from the ABOR processing described 95026050Sminshallabove, or from unexpected behavior by the remote server, including 95126050Sminshallviolations of the ftp protocol. 95226050SminshallIf the delay results from unexpected remote server behavior, the local 95343083Scael.Nm ftp 95426050Sminshallprogram must be killed by hand. 955*44954Scael.Sh FILE NAMING CONVENTIONS 95626050SminshallFiles specified as arguments to 95743083Scael.Nm ftp 95819706Smckusickcommands are processed according to the following rules. 959*44954Scael.Tw Ds 96043083Scael.Tp \&1) 961*44954ScaelIf the file name 962*44954Scael.Sq Fl 963*44954Scaelis specified, the 96443083Scael.Ar stdin 96526050Sminshall(for reading) or 96643083Scael.Ar stdout 96719706Smckusick(for writing) is used. 96843083Scael.Tp \&2) 969*44954ScaelIf the first character of the file name is 970*44954Scael.Sq \&| , 971*44954Scaelthe 97219706Smckusickremainder of the argument is interpreted as a shell command. 97343083Scael.Nm Ftp 97443083Scaelthen forks a shell, using 97543083Scael.Xr popen 3 97626050Sminshallwith the argument supplied, and reads (writes) from the stdout 97726050Sminshall(stdin). If the shell command includes spaces, the argument 97843083Scaelmust be quoted; e.g. \*(Lq" ls -lt"\*(Rq. A particularly 97943083Scaeluseful example of this mechanism is: \*(Lqdir more\*(Rq. 98043083Scael.Tp \&3) 98143083ScaelFailing the above checks, if ``globbing'' is enabled, 98219706Smckusicklocal file names are expanded 98343083Scaelaccording to the rules used in the 98443083Scael.Xr csh 1 ; 98543083Scaelc.f. the 98643083Scael.Ic glob 98743083Scaelcommand. 98826050SminshallIf the 98943083Scael.Nm ftp 990*44954Scaelcommand expects a single local file (.e.g. 99143083Scael.Ic put ) , 99226050Sminshallonly the first filename generated by the "globbing" operation is used. 99343083Scael.Tp \&4) 99426050SminshallFor 99543083Scael.Ic mget 99626050Sminshallcommands and 99743083Scael.Ic get 99826050Sminshallcommands with unspecified local file names, the local filename is 99926050Sminshallthe remote filename, which may be altered by a 100043083Scael.Ic case , 100143083Scael.Ic ntrans , 100226050Sminshallor 100343083Scael.Ic nmap 100426050Sminshallsetting. 100526050SminshallThe resulting filename may then be altered if 100643083Scael.Ic runique 100726050Sminshallis on. 100843083Scael.Tp \&5) 100926050SminshallFor 101043083Scael.Ic mput 101126050Sminshallcommands and 101243083Scael.Ic put 101326050Sminshallcommands with unspecified remote file names, the remote filename is 101426050Sminshallthe local filename, which may be altered by a 101543083Scael.Ic ntrans 101626050Sminshallor 101743083Scael.Ic nmap 101826050Sminshallsetting. 101926050SminshallThe resulting filename may then be altered by the remote server if 102043083Scael.Ic sunique 102126050Sminshallis on. 102243083Scael.Tp 1023*44954Scael.Sh FILE TRANSFER PARAMETERS 102419706SmckusickThe FTP specification specifies many parameters which may 102543083Scaelaffect a file transfer. The 102643083Scael.Ic type 102743083Scaelmay be one of \*(Lqascii\*(Rq, \*(Lqimage\*(Rq (binary), 102843083Scael\*(Lqebcdic\*(Rq, and \*(Lqlocal byte size\*(Rq (for PDP-10's 102926050Sminshalland PDP-20's mostly). 103043083Scael.Nm Ftp 103126050Sminshallsupports the ascii and image types of file transfer, 103243083Scaelplus local byte size 8 for 103343083Scael.Ic tenex 103443083Scaelmode transfers. 103543083Scael.Pp 103643083Scael.Nm Ftp 103726050Sminshallsupports only the default values for the remaining 103843083Scaelfile transfer parameters: 103943083Scael.Ic mode , 104043083Scael.Ic form , 104126050Sminshalland 104243083Scael.Ic struct . 1043*44954Scael.Sh THE .netrc FILE 104426050SminshallThe 104543083Scael.Pa .netrc 104643083Scaelfile contains login and initialization information 104726050Sminshallused by the auto-login process. 104826050SminshallIt resides in the user's home directory. 104926050SminshallThe following tokens are recognized; they may be separated by spaces, 105026050Sminshalltabs, or new-lines: 105143083Scael.Tw password 105243083Scael.Tp Cx Ic machine 1053*44954Scael.Ws 105443083Scael.Ar name 105543083Scael.Cx 1056*44954ScaelIdentify a remote machine 1057*44954Scael.Ar name . 1058*44954ScaelThe auto-login process searches the 1059*44954Scael.Pa .netrc 1060*44954Scaelfile for a 106143083Scael.Ic machine 106226491Sminshalltoken that matches the remote machine specified on the 106343083Scael.Nm ftp 106426050Sminshallcommand line or as an 106543083Scael.Ic open 106626050Sminshallcommand argument. 1067*44954ScaelOnce a match is made, the subsequent 1068*44954Scael.Pa .netrc 1069*44954Scaeltokens are processed, 107026050Sminshallstopping when the end of file is reached or another 107143083Scael.Ic machine 107236940Skarelsor a 107343083Scael.Ic default 107426050Sminshalltoken is encountered. 107543083Scael.Tp Ic default 107643083ScaelThis is the same as 107743083Scael.Ic machine 107843083Scael.Ar name 107943083Scaelexcept that 108043083Scael.Ic default 108136940Skarelsmatches any name. 108243083ScaelThere can be only one 108343083Scael.Ic default 108443083Scaeltoken, and it must be after all 108543083Scael.Ic machine 108643083Scaeltokens. 108736940SkarelsThis is normally used as: 1088*44954Scael.Pp 108943083Scael.Dl default login anonymous password user@site 1090*44954Scael.Pp 109143083Scaelthereby giving the user 109243083Scael.Ar automatic 109343083Scaelanonymous ftp login to 109443083Scaelmachines not specified in 109543083Scael.Pa .netrc . 109643083ScaelThis can be overridden 109743083Scaelby using the 109843083Scael.Fl n 109943083Scaelflag to disable auto-login. 110043083Scael.Tp Cx Ic login 1101*44954Scael.Ws 110243083Scael.Ar name 110343083Scael.Cx 110426050SminshallIdentify a user on the remote machine. 110526050SminshallIf this token is present, the auto-login process will initiate 1106*44954Scaela login using the specified 1107*44954Scael.Ar name . 110843083Scael.Tp Cx Ic password 1109*44954Scael.Ws 111043083Scael.Ar string 111143083Scael.Cx 111226050SminshallSupply a password. 111326050SminshallIf this token is present, the auto-login process will supply the 111426050Sminshallspecified string if the remote server requires a password as part 111526050Sminshallof the login process. 111643083ScaelNote that if this token is present in the 111743083Scael.Pa .netrc 111843083Scaelfile for any user other 111943083Scaelthan 112043083Scael.Ar anonymous , 112143083Scael.Nm ftp 112243083Scaelwill abort the auto-login process if the 112343083Scael.Pa .netrc 112443083Scaelis readable by 112526050Sminshallanyone besides the user. 112643083Scael.Tp Cx Ic account 1127*44954Scael.Ws 112843083Scael.Ar string 112943083Scael.Cx 113026050SminshallSupply an additional account password. 113126050SminshallIf this token is present, the auto-login process will supply the 113226050Sminshallspecified string if the remote server requires an additional 113326050Sminshallaccount password, or the auto-login process will initiate an 113426050SminshallACCT command if it does not. 113543083Scael.Tp Cx Ic macdef 1136*44954Scael.Ws 113743083Scael.Ar name 113843083Scael.Cx 113926050SminshallDefine a macro. 114026050SminshallThis token functions like the 114143083Scael.Nm ftp 114243083Scael.Ic macdef 114326050Sminshallcommand functions. 114426050SminshallA macro is defined with the specified name; its contents begin with the 114543083Scaelnext 114643083Scael.Pa .netrc 114743083Scaelline and continue until a null line (consecutive new-line 114826050Sminshallcharacters) is encountered. 114926050SminshallIf a macro named 115043083Scael.Ic init 115126050Sminshallis defined, it is automatically executed as the last step in the 115226050Sminshallauto-login process. 115343083Scael.Tp 115443083Scael.Sh ENVIRONMENT 115543083Scael.Nm Ftp 1156*44954Scaelutilizes the following environment variables. 1157*44954Scael.Tw Fl 1158*44954Scael.Tp Ev HOME 1159*44954ScaelFor default location of a 1160*44954Scael.Pa .netrc 1161*44954Scaelfile, if one exists. 1162*44954Scael.Tp Ev SHELL 1163*44954ScaelFor default shell. 1164*44954Scael.Tp 116543083Scael.Sh SEE ALSO 116643083Scael.Xr ftpd 8 116743083Scael.Sh HISTORY 116843083Scael.Nm Ftp 116943083Scaelappeared in 4.2 BSD. 117043083Scael.Sh BUGS 117126050SminshallCorrect execution of many commands depends upon proper behavior 117226050Sminshallby the remote server. 117343083Scael.Pp 117427895SkarelsAn error in the treatment of carriage returns 117527895Skarelsin the 4.2BSD UNIX ascii-mode transfer code 117626050Sminshallhas been corrected. 117726050SminshallThis correction may result in incorrect transfers of binary files 117827895Skarelsto and from 4.2BSD servers using the ascii type. 117926050SminshallAvoid this problem by using the binary image type. 1180