📄 ftp.1
字号:
commands and.Ic getcommands issued without a specified local target filename.This command is useful when connecting to a.No non\- Ns Uxremote computerwith different file naming conventions or practices.Characters in a filename matching a character in.Ar incharsare replaced with the corresponding character in.Ar outchars .If the character's position in.Ar incharsis longer than the length of.Ar outchars ,the character is deleted from the file name..It Ic open Ar host Op Ar portEstablish a connection to the specified.Ar host.Tn FTPserver.An optional port number may be supplied,in which case,.Nm ftpwill attempt to contact an.Tn FTPserver at that port.If the.Ic auto-loginoption is on (default),.Nm ftpwill also attempt to automatically log the user in tothe.Tn FTPserver (see below)..It Ic promptToggle interactive prompting.Interactive promptingoccurs during multiple file transfers to allow theuser to selectively retrieve or store files.If prompting is turned off (default is on), any.Ic mgetor.Ic mputwill transfer all files, and any.Ic mdeletewill delete all files..It Ic proxy Ar ftp-commandExecute an ftp command on a secondary control connection.This command allows simultaneous connection to two remote ftpservers for transferring files between the two servers.The first.Ic proxycommand should be an.Ic open ,to establish the secondary control connection.Enter the command "proxy ?" to see other ftp commands executable on thesecondary connection.The following commands behave differently when prefaced by.Ic proxy :.Ic openwill not define new macros during the auto-login process,.Ic closewill not erase existing macro definitions,.Ic getand.Ic mgettransfer files from the host on the primary control connectionto the host on the secondary control connection, and.Ic put ,.Ic mput ,and.Ic appendtransfer files from the host on the secondary control connectionto the host on the primary control connection.Third party file transfers depend upon support of the ftp protocol.Dv PASVcommand by the server on the secondary control connection..It Ic put Ar local-file Op Ar remote-fileStore a local file on the remote machine.If.Ar remote-fileis left unspecified, the local file name is usedafter processing according to any.Ic ntransor.Ic nmapsettingsin naming the remote file.File transfer uses thecurrent settings for.Ic type ,.Ic format ,.Ic mode ,and.Ic structure ..It Ic pwdPrint the name of the current working directory on the remotemachine..It Ic quitA synonym for.Ic bye ..It Ic quote Ar arg1 arg2 ...The arguments specified are sent, verbatim, to the remote.Tn FTPserver..It Ic recv Ar remote-file Op Ar local-fileA synonym for get..It Ic reget Ar remote-file Op Ar local-fileReget acts like get, except that if.Ar local-fileexists and issmaller than.Ar remote-file ,.Ar local-fileis presumed to bea partially transferred copy of.Ar remote-fileand the transferis continued from the apparent point of failure.This commandis useful when transferring very large files over networks thatare prone to dropping connections..It Ic remotehelp Op Ar command-nameRequest help from the remote.Tn FTPserver.If a.Ar command-nameis specified it is supplied to the server as well..It Ic remotestatus Op Ar file-nameWith no arguments, show status of remote machine.If.Ar file-nameis specified, show status of.Ar file-nameon remote machine..It Xo.Ic rename.Op Ar from.Op Ar to.XcRename the file.Ar fromon the remote machine, to the file.Ar to ..It Ic resetClear reply queue.This command re-synchronizes command/reply sequencing with the remoteftp server.Resynchronization may be necessary following a violation of the ftp protocolby the remote server..It Ic restart Ar markerRestart the immediately following.Ic getor.Ic putat theindicated.Ar marker .On.Uxsystems, marker is usually a byteoffset into the file..It Ic rmdir Ar directory-nameDelete a directory on the remote machine..It Ic runiqueToggle storing of files on the local system with unique filenames.If a file already exists with a name equal to the targetlocal filename for a.Ic getor.Ic mgetcommand, a ".1" is appended to the name.If the resulting name matches another existing file,a ".2" is appended to the original name.If this process continues up to ".99", an errormessage is printed, and the transfer does not take place.The generated unique filename will be reported.Note that.Ic runiquewill not affect local files generated from a shell command(see below).The default value is off..It Ic send Ar local-file Op Ar remote-fileA synonym for put..It Ic sendportToggle the use of.Dv PORTcommands.By default,.Nm ftpwill attempt to use a.Dv PORTcommand when establishinga connection for each data transfer.The use of.Dv PORTcommands can prevent delayswhen performing multiple file transfers.If the.Dv PORTcommand fails,.Nm ftpwill use the default data port.When the use of.Dv PORTcommands is disabled, no attempt will be made to use.Dv PORTcommands for each data transfer.This is usefulfor certain.Tn FTPimplementations which do ignore.Dv PORTcommands but, incorrectly, indicate they've been accepted..It Ic site Ar arg1 arg2 ...The arguments specified are sent, verbatim, to the remote.Tn FTPserver as a.Dv SITEcommand..It Ic size Ar file-nameReturn size of.Ar file-nameon remote machine..It Ic statusShow the current status of.Nm ftp ..It Ic struct Op Ar struct-nameSet the file transfer.Ar structureto.Ar struct-name .By default \*(Lqstream\*(Rq structure is used..It Ic suniqueToggle storing of files on remote machine under unique file names.Remote ftp server must support ftp protocol.Dv STOUcommand forsuccessful completion.The remote server will report unique name.Default value is off..It Ic systemShow the type of operating system running on the remote machine..It Ic tenexSet the file transfer type to that needed totalk to.Tn TENEXmachines..It Ic traceToggle packet tracing..It Ic type Op Ar type-nameSet the file transfer.Ic typeto.Ar type-name .If no type is specified, the current typeis printed.The default type is network.Tn ASCII ..It Ic umask Op Ar newmaskSet the default umask on the remote server to.Ar newmask .If.Ar newmaskis ommitted, the current umask is printed..It Xo.Ic user Ar user-name.Op Ar password.Op Ar account.XcIdentify yourself to the remote.Tn FTPserver.If the.Ar passwordis not specified and the server requires it,.Nm ftpwill prompt the user for it (after disabling local echo).If an.Ar accountfield is not specified, and the.Tn FTPserverrequires it, the user will be prompted for it.If an.Ar accountfield is specified, an account command willbe relayed to the remote server after the login sequenceis completed if the remote server did not require itfor logging in.Unless.Nm ftpis invoked with \*(Lqauto-login\*(Rq disabled, thisprocess is done automatically on initial connection tothe.Tn FTPserver..It Ic verboseToggle verbose mode.In verbose mode, all responses fromthe.Tn FTPserver are displayed to the user.In addition,if verbose is on, when a file transfer completes, statisticsregarding the efficiency of the transfer are reported.By default,verbose is on..It Ic ? Op Ar commandA synonym for help..El.PpCommand arguments which have embedded spaces may be quoted withquote `"' marks..Sh ABORTING A FILE TRANSFERTo abort a file transfer, use the terminal interrupt key(usually Ctrl-C).Sending transfers will be immediately halted.Receiving transfers will be halted by sending a ftp protocol.Dv ABORcommand to the remote server, and discarding any further data received.The speed at which this is accomplished depends upon the remoteserver's support for.Dv ABORprocessing.If the remote server does not support the.Dv ABORcommand, an.Ql ftp>prompt will not appear until the remote server has completedsending the requested file..PpThe terminal interrupt key sequence will be ignored when.Nm ftphas completed any local processing and is awaiting a replyfrom the remote server.A long delay in this mode may result from the ABOR processing describedabove, or from unexpected behavior by the remote server, includingviolations of the ftp protocol.If the delay results from unexpected remote server behavior, the local.Nm ftpprogram must be killed by hand..Sh FILE NAMING CONVENTIONSFiles specified as arguments to.Nm ftpcommands are processed according to the following rules..Bl -enum.ItIf the file name.Sq Flis specified, the.Ar stdin(for reading) or.Ar stdout(for writing) is used..ItIf the first character of the file name is.Sq \&| ,theremainder of the argument is interpreted as a shell command..Nm Ftpthen forks a shell, using.Xr popen 3with the argument supplied, and reads (writes) from the stdout(stdin).If the shell command includes spaces, the argumentmust be quoted; e.g.\*(Lq" ls -lt"\*(Rq.A particularlyuseful example of this mechanism is: \*(Lqdir more\*(Rq..ItFailing the above checks, if ``globbing'' is enabled,local file names are expandedaccording to the rules used in the.Xr csh 1 ;c.f. the.Ic globcommand.If the.Nm ftpcommand expects a single local file (.e.g..Ic put ) ,only the first filename generated by the "globbing" operation is used..ItFor.Ic mgetcommands and.Ic getcommands with unspecified local file names, the local filename isthe remote filename, which may be altered by a.Ic case ,.Ic ntrans ,or.Ic nmapsetting.The resulting filename may then be altered if.Ic runiqueis on..ItFor.Ic mputcommands and.Ic putcommands with unspecified remote file names, the remote filename isthe local filename, which may be altered by a.Ic ntransor.Ic nmapsetting.The resulting filename may then be altered by the remote server if.Ic suniqueis on..El.Sh FILE TRANSFER PARAMETERSThe FTP specification specifies many parameters which mayaffect a file transfer.The.Ic typemay be one of \*(Lqascii\*(Rq, \*(Lqimage\*(Rq (binary),\*(Lqebcdic\*(Rq, and \*(Lqlocal byte size\*(Rq (for.Tn PDP Ns -10'sand.Tn PDP Ns -20'smostly)..Nm Ftpsupports the ascii and image types of file transfer,plus local byte size 8 for.Ic tenexmode transfers..Pp.Nm Ftpsupports only the default values for the remainingfile transfer parameters:.Ic mode ,.Ic form ,and.Ic struct ..Sh THE .netrc FILEThe.Pa .netrcfile contains login and initialization informationused by the auto-login process.It resides in the user's home directory.The following tokens are recognized; they may be separated by spaces,tabs, or new-lines:.Bl -tag -width password.It Ic machine Ar nameIdentify a remote machine.Ar name .The auto-login process searches the.Pa .netrcfile for a.Ic machinetoken that matches the remote machine specified on the.Nm ftpcommand line or as an.Ic opencommand argument.Once a match is made, the subsequent.Pa .netrctokens are processed,stopping when the end of file is reached or another.Ic machineor a.Ic defaulttoken is encountered..It Ic defaultThis is the same as.Ic machine.Ar nameexcept that.Ic defaultmatches any name.There can be only one.Ic defaulttoken, and it must be after all.Ic machinetokens.This is normally used as:.Pp.Dl default login anonymous password user@site.Ppthereby giving the user.Ar automaticanonymous ftp login tomachines not specified in.Pa .netrc .This can be overriddenby using the.Fl nflag to disable auto-login..It Ic login Ar nameIdentify a user on the remote machine.If this token is present, the auto-login process will initiatea login using the specified.Ar name ..It Ic password Ar stringSupply a password.If this token is present, the auto-login process will supply thespecified string if the remote server requires a password as partof the login process.Note that if this token is present in the.Pa .netrcfile for any user otherthan.Ar anonymous ,.Nm ftpwill abort the auto-login process if the.Pa .netrcis readable byanyone besides the user..It Ic account Ar stringSupply an additional account password.If this token is present, the auto-login process will supply thespecified string if the remote server requires an additionalaccount password, or the auto-login process will initiate an.Dv ACCTcommand if it does not..It Ic macdef Ar nameDefine a macro.This token functions like the.Nm ftp.Ic macdefcommand functions.A macro is defined with the specified name; its contents begin with thenext.Pa .netrcline and continue until a null line (consecutive new-linecharacters) is encountered.If a macro named.Ic initis defined, it is automatically executed as the last step in theauto-login process..El.Sh ENVIRONMENT.Nm Ftputilizes the following environment variables..Bl -tag -width Fl.It Ev HOMEFor default location of a.Pa .netrcfile, if one exists..It Ev SHELLFor default shell..El.Sh SEE ALSO.Xr ftpd 8.Sh HISTORYThe.Nm ftpcommand appeared in.Bx 4.2 ..Sh BUGSCorrect execution of many commands depends upon proper behaviorby the remote server..PpAn error in the treatment of carriage returnsin the.Bx 4.2ascii-mode transfer codehas been corrected.This correction may result in incorrect transfers of binary filesto and from.Bx 4.2servers using the ascii type.Avoid this problem by using the binary image type.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -