📄 ftp.texi
字号:
@node ftp@chapter ftp@cindex ftp@command{Ftp} is the user interface to the ARPANET standard File TransferProtocol. The program allows a user to transfer files to and from a remotenetwork site.@section InvokingThe options are as follows:@table @samp@item -d@itemx --debug@opindex -d@opindex --debugEnables debugging.@item -g@itemx --no-glob@opindex -g@opindex --no-globDisables file name globbing.@item -i@itemx --no-prompt@opindex -i@opindex --no-promptTurns off interactive prompting during multiple file transfers.@item -n@itemx --no-login@opindex -n@opindex --no-loginRestrains ftp from attempting ``auto-login'' upon initial connection.If auto-login is enabled, ftp will check the .netrc (see below) filein the user's home directory for an entry describing an account on theremote machine. If no entry exists, ftp will prompt for the remotemachine login name (default is the user identity on the local machine),and, if necessary, prompt for a password and an account with which to login.@item -t@item --trace@opindex -t@opindex --traceEnable packet tracing.@item -p @var{PROMPT}@itemx --prompt=@var{PROMPT}@opindex -p@opindex --promptPrint a command-line prompt (optionally PROMPT), even if not on a tty.@item -v@itemx --verbose@opindex -v@opindex --verboseBe verbose.@end table@section CommandsThe client host with which ftp is to communicate may be specified on thecommand line. If this is done, ftp will immediately attempt to establisha connection to an FTP server on that host; otherwise, ftp will enter itscommand interpreter and await instructions from the user. When ftp isawaiting commands from the user the prompt `ftp>' is provided to the user.The following commands are recognized by ftp:@table @samp@item ! [command [args]]Invoke an interactive shell on the local machine. If thereare arguments, the first is taken to be a command to executedirectly, with the rest of the arguments as its arguments.@item $ macro-name [args]Execute the macro macro-name that was defined with the macdefcommand. Arguments are passed to the macro unglobbed.@item account [passwd]Supply a supplemental password required by a remote systemfor access to resources once a login has been successfullycompleted. If no argument is included, the user will beprompted for an account password in a non-echoing input mode.@item append local-file [remote-file]Append a local file to a file on the remote machine. Ifremote-file is left unspecified, the local file name is usedin naming the remote file after being altered by any ntransor nmap setting. File transfer uses the current settings fortype, format, mode, and structure.@item asciiSet the file transfer type to network ASCII. This is the default type.@item bellArrange that a bell be sounded after each file transfer command is completed.@item binarySet the file transfer type to support binary image transfer.@item byeTerminate the FTP session with the remote server and exitftp. An end of file will also terminate the session and exit.@item caseToggle remote computer file name case mapping during mgetcommands. When case is on (default is off), remote computerfile names with all letters in upper case are written in thelocal directory with the letters mapped to lower case.@item cd remote-directoryChange the working directory on the remote machine to remote-directory.@item cdupChange the remote machine working directory to the parent ofthe current remote machine working directory.@item chmod mode file-nameChange the permission modes of the file file-name on the re-mote sytem to mode.@item closeTerminate the FTP session with the remote server, and returnto the command interpreter. Any defined macros are erased.@item crToggle carriage return stripping during ascii type file retrieval.Records are denoted by a carriage return/linefeedsequence during ascii type file transfer. When cr is on (thedefault), carriage returns are stripped from this sequence toconform with the UNIX single linefeed record delimiter.Records on non-UNIX remote systems may contain single linefeeds;when an ascii type transfer is made, these linefeedsmay be distinguished from a record delimiter only when cr is off.@item delete remote-fileDelete the file remote-file on the remote machine.@item debug [debug-value]Toggle debugging mode. If an optional debug-value is specifiedit is used to set the debugging level. When debuggingis on, ftp prints each command sent to the remote machine,preceded by the string `-->'@item dir [remote-directory] [local-file]Print a listing of the directory contents in the directory,remote-directory, and, optionally, placing the output inlocal-file. If interactive prompting is on, ftp will promptthe user to verify that the last argument is indeed the tar-get local file for receiving dir output. If no directory isspecified, the current working directory on the remote ma-chine is used. If no local file is specified, or local-fileis -, output comes to the terminal.@item disconnectA synonym for close.@item form formatSet the file transfer form to format. The default format is ``file''.@item get remote-file [local-file]Retrieve the remote-file and store it on the local machine.If the local file name is not specified, it is given the samename it has on the remote machine, subject to alteration bythe current case, ntrans, and nmap settings. The currentsettings for type, form, mode, and structure are used whiletransferring the file.@item globToggle filename expansion for mdelete, mget and mput. Ifglobbing is turned off with glob, the file name arguments aretaken literally and not expanded. Globbing for mput is doneas in csh(1). For mdelete and mget, each remote file name isexpanded separately on the remote machine and the lists arenot merged. Expansion of a directory name is likely to bedifferent from expansion of the name of an ordinary file: theexact result depends on the foreign operating system and ftpserver, and can be previewed by doing `mls remote-files -'Note: mget and mput are not meant to transfer entire directo-ry subtrees of files. That can be done by transferring atar(1) archive of the subtree (in binary mode).@item hash [size]Toggle hash-sign (``#'') printing for each data block transferred.The size of a data block can optionally be specified. If not given,it defaults to 1024 bytes.@item help [command]Print an informative message about the meaning of command. Ifno argument is given, ftp prints a list of the known commands.@item idle [seconds]Set the inactivity timer on the remote server to seconds seconds.If seconds is omitted, the current inactivity timer is printed.@item lcd [directory]Change the working directory on the local machine. If nodirectory is specified, the user's home directory is used.@item ls [remote-directory] [local-file]Print a listing of the contents of a directory on the remotemachine. The listing includes any system-dependent information thatthe server chooses to include; for example, mostUNIX systems will produce output from the command `ls -l'.(See also nlist.) If remote-directory is left unspecified,the current working directory is used. If interactiveprompting is on, ftp will prompt the user to verify that thelast argument is indeed the target local file for receivingls output. If no local file is specified, or if local-fileis `-', the output is sent to the terminal.@item macdef macro-nameDefine a macro. Subsequent lines are stored as the macromacro-name; a null line (consecutive newline characters in afile or carriage returns from the terminal) terminates macroinput mode. There is a limit of 16 macros and 4096 totalcharacters in all defined macros. Macros remain defined until aclose command is executed. The macro processor interprets `$'and `\' as special characters. A `$' followed by anumber (or numbers) is replaced by the corresponding argumenton the macro invocation command line. A `$' followed by an`i' signals that macro processor that the executing macro isto be looped. On the first pass `$i' is replaced by thefirst argument on the macro invocation command line, on thesecond pass it is replaced by the second argument, and so on.A `\' followed by any character is replaced by that character.Use the `\' to prevent special treatment of the `$'.@item mdelete [remote-files]Delete the remote-files on the remote machine.@item mdir remote-files local-fileLike dir, except multiple remote files may be specified. Ifinteractive prompting is on, ftp will prompt the user to verify thatthe last argument is indeed the target local file for receiving mdir output.@item mget remote-filesExpand the remote-files on the remote machine and do a getfor each file name thus produced. See glob for details onthe filename expansion. Resulting file names will then beprocessed according to case, ntrans, and nmap settings.Files are transferred into the local working directory, whichcan be changed with `lcd directory'; new local directoriescan be created with `! mkdir directory'.@item mkdir directory-nameMake a directory on the remote machine.@item mls remote-files local-fileLike nlist, except multiple remote files may be specified,and the local-file must be specified. If interactive prompting is on,ftp will prompt the user to verify that the lastargument is indeed the target local file for receiving mls output.@item mode [mode-name]Set the file transfer mode to mode-name. The default mode is``stream'' mode.@item modtime file-nameShow the last modification time of the file on the remote machine.@item mput local-filesExpand wild cards in the list of local files given as arguments and doa put for each file in the resulting list. See glob for details offilename expansion. Resulting file names will then be processedaccording to ntrans and nmap settings.@item newer file-nameGet the file only if the modification time of the remote fileis more recent that the file on the current system. If thefile does not exist on the current system, the remote file isconsidered newer. Otherwise, this command is identical to get.@item nlist [remote-directory] [local-file]Print a list of the files in a directory on the remote machine.If remote-directory is left unspecified, the currentworking directory is used. If interactive prompting is on,ftp will prompt the user to verify that the last argument isindeed the target local file for receiving nlist output. Ifno local file is specified, or if local-file is -, the outputis sent to the terminal.@item nmap [inpattern outpattern]Set or unset the filename mapping mechanism. If no argumentsare specified, the filename mapping mechanism is unset. Ifarguments are specified, remote filenames are mapped duringmput commands and put commands issued without a specified remote targetfilename. If arguments are specified, localfilenames are mapped during mget commands and get commandsissued without a specified local target filename. This command isuseful when connecting to a non-UNIX remote computerwith different file naming conventions or practices. Themapping follows the pattern set by inpattern and outpattern.[Inpattern] is a template for incoming filenames (which mayhave already been processed according to the ntrans and casesettings). Variable templating is accomplished by includingthe sequences `$1', `$2', ..., `$9' in inpattern. Use `\' toprevent this special treatment of the `$' character. Allother characters are treated literally, and are used to de-termine the nmap [inpattern] variable values. For example,given inpattern $1.$2 and the remote file name "mydata.data",$1 would have the value "mydata", and $2 would have the valuedata". The outpattern determines the resulting mapped filename.The sequences `$1', `$2', ...., `$9' are replaced byany value resulting from the inpattern template. The sequence `$0' isreplace by the original filename. Additionally, the sequence`[seq1, seq2]' is replaced by [seq1] if seq1is not a null string; otherwise it is replaced by seq2. Forexample, the command@example nmap $1.$2.$3 [$1,$2].[$2,file]@end examplewould yield the output filename "myfile.data" for input filenames"myfile.data" and "myfile.data.old", "myfile.file" forthe input filename "myfile", and "myfile.myfile" for the in-put filename ".myfile". Spaces may be included inoutpattern, as in the example: `nmap $1 sed "s/ *$//" > $1'.Use the `\' character to prevent special treatment of the`$','[','[', and `,' characters.@item ntrans [inchars [outchars]]Set or unset the filename character translation mechanism.If no arguments are specified, the filename character translationmechanism is unset. If arguments are specified, characters in remotefilenames are translated during mput commands and put commands issuedwithout a specified remote target filename. If arguments are specified,characters in local filenames are translated during mget commands and getcommands issued without a specified local target filename.This command is useful when connecting to a non-UNIX remotecomputer with different file naming conventions or practices.Characters in a filename matching a character in inchars are
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -