1.\" Copyright (c) 1985, 1989, 1990 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)ftp.1 6.14 (Berkeley) 06/11/90 7.\" 8.Dd 9.Dt FTP 1 10.Os BSD 4.2 11.Sh NAME 12.Nm ftp 13.Nd ARPANET file transfer program 14.Sh SYNOPSIS 15.Nm ftp 16.Op Fl v 17.Op Fl d 18.Op Fl i 19.Op Fl n 20.Op Fl g 21.Op Ar host 22.Sh DESCRIPTION 23.Nm Ftp 24is the user interface to the ARPANET standard File Transfer Protocol. 25The program allows a user to transfer files to and from a 26remote network site. 27.Pp 28Options may be specified at the command line, or to the 29command interpreter. 30.Tp Fl v 31Verbose option forces 32.Nm ftp 33to show all responses from the remote server, as well 34as report on data transfer statistics. 35.Tp Fl n 36Restrains 37.Nm ftp 38from attempting \*(Lqauto-login\*(Rq upon initial connection. 39If auto-login is enabled, 40.Nm ftp 41will check the 42.Pa .netrc 43(see below) file in the user's home directory for an entry describing 44an account on the remote machine. If no entry exists, 45.Nm ftp 46will prompt for the remote machine login name (default is the user 47identity on the local machine), and, if necessary, prompt for a password 48and an account with which to login. 49.Tp Fl i 50Turns off interactive prompting during 51multiple file transfers. 52.Tp Fl d 53Enables debugging. 54.Tp Fl g 55Disables file name globbing. 56.Tp 57.Pp 58The client host with which 59.Nm ftp 60is to communicate may be specified on the command line. 61If this is done, 62.Nm ftp 63will immediately attempt to establish a connection to an FTP 64server on that host; otherwise, 65.Nm ftp 66will enter its command interpreter and await instructions 67from the user. When 68.Nm ftp 69is awaiting commands from the user the prompt \*(Lqftp>\*(Rq 70is provided to the user. The following commands are recognized 71by 72.Nm ftp : 73.Tw Fl 74.Tp Cx Ic \&! 75.Cx \&\ \& 76.Op Ar command Op Ar args 77.Cx 78Invoke an interactive shell on the local machine. 79If there are arguments, the first is taken to be a command to execute 80directly, with the rest of the arguments as its arguments. 81.Tp Cx Ic \&$ 82.Cx \&\ \& 83.Ar macro-name 84.Op Ar args 85.Cx 86Execute the macro 87.Ar macro-name 88that was defined with the 89.Ic macdef 90command. 91Arguments are passed to the macro unglobbed. 92.Tp Cx Ic account 93.Cx \&\ \& 94.Op Ar passwd 95.Cx 96Supply a supplemental password required by a remote system for access 97to resources once a login has been successfully completed. 98If no argument is included, the user will be prompted for an account 99password in a non-echoing input mode. 100.Tp Cx Ic append 101.Cx \&\ \& 102.Ar local-file 103.Cx \&\ \& 104.Op Ar remote-file 105.Cx 106Append a local file to a file on the remote machine. If 107.Ar remote-file 108is left unspecified, the local file name is used in naming the 109remote file after being altered by any 110.Ic ntrans 111or 112.Ic nmap 113setting. 114File transfer uses the current settings for 115.Ic type , 116.Ic format , 117.Ic mode , 118and 119.Ic structure . 120.Tp Ic ascii 121Set the file transfer 122.Ic type 123to network ASCII. This is the default type. 124.Tp Ic bell 125Arrange that a bell be sounded after each file transfer 126command is completed. 127.Tp Ic binary 128Set the file transfer 129.Ic type 130to support binary image transfer. 131.Tp Ic bye 132Terminate the FTP session with the remote server 133and exit 134.Nm ftp . 135An end of file will also terminate the session and exit. 136.Tp Ic case 137Toggle remote computer file name case mapping during 138.Ic mget 139commands. 140When 141.Ic case 142is on (default is off), remote computer file names with all letters in 143upper case are written in the local directory with the letters mapped 144to lower case. 145.Tp Cx Ic cd 146.Cx \&\ \& 147.Ar remote-directory 148.Cx 149Change the working directory on the remote machine 150to 151.Ar remote-directory . 152.Tp Ic cdup 153Change the remote machine working directory to the parent of the 154current remote machine working directory. 155.Tp Cx Ic chmod 156.Cx \&\ \& 157.Ar mode file-name 158.Cx 159Change the permission modes the file 160.Ar file-name 161on the remote 162sytem to 163.Ic mode . 164.Tp Ic close 165Terminate the FTP session with the remote server, and 166return to the command interpreter. 167Any defined macros are erased. 168.Tp Ic cr 169Toggle carriage return stripping during 170ascii type file retrieval. 171Records are denoted by a carriage return/linefeed sequence 172during ascii type file transfer. 173When 174.Ic cr 175is on (the default), carriage returns are stripped from this 176sequence to conform with the UNIX single linefeed record 177delimiter. 178Records on non-UNIX remote systems may contain single linefeeds; 179when an ascii type transfer is made, these linefeeds may be 180distinguished from a record delimiter only when 181.Ic cr 182is off. 183.Tp Cx Ic delete 184.Cx \&\ \& 185.Ar remote-file 186.Cx 187Delete the file 188.Ar remote-file 189on the remote machine. 190.Tp Cx Ic debug 191.Cx \&\ \& 192.Op Ar debug-value 193.Cx 194Toggle debugging mode. If an optional 195.Ar debug-value 196is specified it is used to set the debugging level. 197When debugging is on, 198.Nm ftp 199prints each command sent to the remote machine, preceded 200by the string \*(Lq-->\*(Rq. 201.Tp Cx Ic dir 202.Cx \&\ \& 203.Op Ar remote-directory 204.Cx \&\ \& 205.Op Ar local-file 206.Cx 207Print a listing of the directory contents in the 208directory, 209.Ar remote-directory , 210and, optionally, placing the output in 211.Ar local-file . 212If interactive prompting is on, 213.Nm ftp 214will prompt the user to verify that the last argument is indeed the 215target local file for receiving 216.Ic dir 217output. 218If no directory is specified, the current working 219directory on the remote machine is used. If no local 220file is specified, or 221.Ar local-file 222is 223.Fl , 224output comes to the terminal. 225.Tp Ic disconnect 226A synonym for 227.Ar close . 228.Tp Cx Ic form 229.Cx \&\ \& 230.Ar format 231.Cx 232Set the file transfer 233.Ic form 234to 235.Ar format . 236The default format is \*(Lqfile\*(Rq. 237.Tp Cx Ic get 238.Cx \&\ \& 239.Ar remote-file 240.Cx \&\ \& 241.Op Ar local-file 242.Cx 243Retrieve the 244.Ar remote-file 245and store it on the local machine. If the local 246file name is not specified, it is given the same 247name it has on the remote machine, subject to 248alteration by the current 249.Ic case , 250.Ic ntrans , 251and 252.Ic nmap 253settings. 254The current settings for 255.Ic type , 256.Ic form , 257.Ic mode , 258and 259.Ic structure 260are used while transferring the file. 261.Tp Ic glob 262Toggle filename expansion for 263.Ic mdelete , 264.Ic mget 265and 266.Ic mput . 267If globbing is turned off with 268.Ic glob , 269the file name arguments 270are taken literally and not expanded. 271Globbing for 272.Ic mput 273is done as in 274.Xr csh 1 . 275For 276.Ic mdelete 277and 278.Ic mget , 279each remote file name is expanded 280separately on the remote machine and the lists are not merged. 281Expansion of a directory name is likely to be 282different from expansion of the name of an ordinary file: 283the exact result depends on the foreign operating system and ftp server, 284and can be previewed by doing 285.Cx ` 286.Cx Li mls remote-files \- 287.Cx \'. 288.Cx 289Note: 290.Ic mget 291and 292.Ic mput 293are not meant to transfer 294entire directory subtrees of files. That can be done by 295transferring a 296.Xr tar 1 297archive of the subtree (in binary mode). 298.Tp Ic hash 299Toggle hash-sign (``#'') printing for each data block 300transferred. The size of a data block is 1024 bytes. 301.Tp Cx Ic help 302.Cx \&\ \& 303.Op Ar command 304.Cx 305Print an informative message about the meaning of 306.Ar command . 307If no argument is given, 308.Nm ftp 309prints a list of the known commands. 310.Tp Cx Ic idle 311.Cx \&\ \& 312.Op Ar seconds 313.Cx 314Set the inactivity timer on the remote server to 315.Ar seconds 316seconds. 317If 318.Ar seconds 319is ommitted, the current inactivity timer is printed. 320.Tp Cx Ic lcd 321.Cx \&\ \& 322.Op Ar directory 323.Cx 324Change the working directory on the local machine. If 325no 326.Ar directory 327is specified, the user's home directory is used. 328.Tp Cx Ic ls 329.Cx \&\ \& 330.Op Ar remote-directory 331.Cx \&\ \& 332.Op Ar local-file 333.Cx 334Print a listing of the contents of a 335directory on the remote machine. 336The listing includes any system-dependent information that the server 337chooses to include; for example, most UNIX systems will produce 338output from the command \*(Lqls -l\*(Rq. 339(See also 340.Ic nlist . 341) 342If 343.Ar remote-directory 344is left unspecified, the current working directory is used. 345If interactive prompting is on, 346.Nm ftp 347will prompt the user to verify that the last argument is indeed the 348target local file for receiving 349.Ic ls 350output. 351If no local file is specified, or if 352.Ar local-file 353is 354.Fl , 355the output is sent to the terminal. 356.Tp Cx Ic macdef 357.Cx \&\ \& 358.Ar macro-name 359.Cx 360Define a macro. 361Subsequent lines are stored as the macro 362.Ar macro-name ; 363a null line (consecutive newline characters 364in a file or 365carriage returns from the terminal) terminates macro input mode. 366There is a limit of 16 macros and 4096 total characters in all 367defined macros. 368Macros remain defined until a 369.Ic close 370command is executed. 371The macro processor interprets '$' and '\\' as special characters. 372A '$' followed by a number (or numbers) is replaced by the 373corresponding argument on the macro invocation command line. 374A '$' followed by an 'i' signals that macro processor that the 375executing macro is to be looped. On the first pass '$i' is 376replaced by the first argument on the macro invocation command line, 377on the second pass it is replaced by the second argument, and so on. 378A '\\' followed by any character is replaced by that character. 379Use the '\\' to prevent special treatment of the '$'. 380.Tp Cx Ic mdelete 381.Cx \&\ \& 382.Op Ar remote-files 383.Cx 384Delete the 385.Ar remote-files 386on the remote machine. 387.Tp Cx Ic mdir 388.Cx \&\ \& 389.Ar remote-files 390.Cx \&\ \& 391.Ar local-file 392.Cx 393Like 394.Ic dir , 395except multiple remote files may be specified. 396If interactive prompting is on, 397.Nm ftp 398will prompt the user to verify that the last argument is indeed the 399target local file for receiving 400.Ic mdir 401output. 402.Tp Cx Ic mget 403.Cx \&\ \& 404.Ar remote-files 405.Cx 406Expand the 407.Ar remote-files 408on the remote machine 409and do a 410.Ic get 411for each file name thus produced. 412See 413.Ic glob 414for details on the filename expansion. 415Resulting file names will then be processed according to 416.Ic case , 417.Ic ntrans , 418and 419.Ic nmap 420settings. 421Files are transferred into the local working directory, 422which can be changed with 423.Cx ` 424.Cx Li lcd directory 425.Cx \'; 426new local directories can be created with 427.Cx Li \&! mkdir directory 428.Cx \'. 429.Tp Cx Ic mkdir 430.Cx \&\ \& 431.Ar directory-name 432.Cx 433Make a directory on the remote machine. 434.Tp Cx Ic mls 435.Cx \&\ \& 436.Ar remote-files 437.Cx \&\ \& 438.Ar local-file 439.Cx 440Like 441.Ic nlist , 442except multiple remote files may be specified, 443and the 444.Ar local-file 445must be specified. 446If interactive prompting is on, 447.Nm ftp 448will prompt the user to verify that the last argument is indeed the 449target local file for receiving 450.Ic mls 451output. 452.Tp Cx Ic mode 453.Cx \&\ \& 454.Op Ar mode-name 455.Cx 456Set the file transfer 457.Ic mode 458to 459.Ar mode-name . 460The default mode is \*(Lqstream\*(Rq mode. 461.Tp Cx Ic modtime 462.Cx \&\ \& 463.Ar file-name 464.Cx 465Show the last modification time of the file on the remote machine. 466.Tp Cx Ic mput 467.Cx \&\ \& 468.Ar local-files 469.Cx 470Expand wild cards in the list of local files given as arguments 471and do a 472.Ic put 473for each file in the resulting list. 474See 475.Ic glob 476for details of filename expansion. 477Resulting file names will then be processed according to 478.Ic ntrans 479and 480.Ic nmap 481settings. 482.Tp Cx Ic newer 483.Cx \&\ \& 484.Ar file-name 485.Cx 486Get the file only if the modification time of the remote file is more 487recent that the file on the current system. If the file does not 488exist on the current system, the remote file is considered 489.Ic newer . 490Otherwise, this command is identical to 491.Ar get . 492.Tp Cx Ic nlist 493.Cx \&\ \& 494.Op Ar remote-directory 495.Cx \&\ \& 496.Op Ar local-file 497.Cx 498Print a list of the files of a 499directory on the remote machine. If 500.Ar remote-directory 501is left unspecified, the current working directory is used. 502If interactive prompting is on, 503.Nm ftp 504will prompt the user to verify that the last argument is indeed the 505target local file for receiving 506.Ic nlist 507output. 508If no local file is specified, or if 509.Ar local-file 510is 511.Fl , 512the output is sent to the terminal. 513.Tp Cx Ic nmap 514.Cx \&\ \& 515.Op Ar inpattern outpattern 516.Cx 517Set or unset the filename mapping mechanism. 518If no arguments are specified, the filename mapping mechanism is unset. 519If arguments are specified, remote filenames are mapped during 520.Ic mput 521commands and 522.Ic put 523commands issued without a specified remote target filename. 524If arguments are specified, local filenames are mapped during 525.Ic mget 526commands and 527.Ic get 528commands issued without a specified local target filename. 529This command is useful when connecting to a non-UNIX remote computer 530with different file naming conventions or practices. 531The mapping follows the pattern set by 532.Ar inpattern 533and 534.Ar outpattern . 535.Op Ar Inpattern 536is a template for incoming filenames (which may have already been 537processed according to the 538.Ic ntrans 539and 540.Ic case 541settings). 542Variable templating is accomplished by including the sequences '$1', '$2', ..., '$9' in 543.Ar inpattern . 544Use '\\' to prevent this special treatment of the '$' character. 545All other characters are treated literally, and are used to determine the 546.Ic nmap 547.Op Ar inpattern 548variable values. 549For example, given 550.Ar inpattern 551$1.$2 and the remote file name "mydata.data", $1 would have the value 552"mydata", and $2 would have the value "data". 553The 554.Ar outpattern 555determines the resulting mapped filename. 556The sequences '$1', '$2', ...., '$9' are replaced by any value resulting 557from the 558.Ar inpattern 559template. 560The sequence '$0' is replace by the original filename. 561Additionally, the sequence 562.Cx ` 563.Op Ar seq1 , Ar seq2 564.Cx \' 565is replaced by 566.Op Ar seq1 567if 568.Ar seq1 569is not a null string; otherwise it is replaced by 570.Ar seq2 . 571For example, the command 572.Pp 573.Df I 574nmap $1.$2.$3 575.Cx Op $1,$2 576.Cx . 577.Op $2,file 578.Cx 579.De 580.Pp 581would yield 582the output filename "myfile.data" for input filenames "myfile.data" and 583"myfile.data.old", "myfile.file" for the input filename "myfile", and 584"myfile.myfile" for the input filename ".myfile". 585Spaces may be included in 586.Ar outpattern , 587as in the example: nmap $1 sed "s/ *$//" > $1 . 588Use the '\\' character to prevent special treatment 589of the '$','[','[', and ',' characters. 590.Tp Cx Ic ntrans 591.Cx \&\ \& 592.Op Ar inchars Op Ar outchars 593.Cx 594Set or unset the filename character translation mechanism. 595If no arguments are specified, the filename character 596translation mechanism is unset. 597If arguments are specified, characters in 598remote filenames are translated during 599.Ic mput 600commands and 601.Ic put 602commands issued without a specified remote target filename. 603If arguments are specified, characters in 604local filenames are translated during 605.Ic mget 606commands and 607.Ic get 608commands issued without a specified local target filename. 609This command is useful when connecting to a non-UNIX remote computer 610with different file naming conventions or practices. 611Characters in a filename matching a character in 612.Ar inchars 613are replaced with the corresponding character in 614.Ar outchars . 615If the character's position in 616.Ar inchars 617is longer than the length of 618.Ar outchars , 619the character is deleted from the file name. 620.Tp Cx Ic open 621.Cx \&\ \& 622.Ar host 623.Cx \&\ \& 624.Op Ar port 625.Cx 626Establish a connection to the specified 627.Ar host 628FTP server. An optional port number may be supplied, 629in which case, 630.Nm ftp 631will attempt to contact an FTP server at that port. 632If the 633.Ic auto-login 634option is on (default), 635.Nm ftp 636will also attempt to automatically log the user in to 637the FTP server (see below). 638.Tp Ic prompt 639Toggle interactive prompting. Interactive prompting 640occurs during multiple file transfers to allow the 641user to selectively retrieve or store files. 642If prompting is turned off (default is on), any 643.Ic mget 644or 645.Ic mput 646will transfer all files, and any 647.Ic mdelete 648will delete all files. 649.Tp Cx Ic proxy 650.Cx \&\ \& 651.Ar ftp-command 652.Cx 653Execute an ftp command on a secondary control connection. 654This command allows simultaneous connection to two remote ftp 655servers for transferring files between the two servers. 656The first 657.Ic proxy 658command should be an 659.Ic open , 660to establish the secondary control connection. 661Enter the command "proxy ?" to see other ftp commands executable on the 662secondary connection. 663The following commands behave differently when prefaced by 664.Ic proxy : 665.Ic open 666will not define new macros during the auto-login process, 667.Ic close 668will not erase existing macro definitions, 669.Ic get 670and 671.Ic mget 672transfer files from the host on the primary control connection 673to the host on the secondary control connection, and 674.Ic put , 675.Ic mput , 676and 677.Ic append 678transfer files from the host on the secondary control connection 679to the host on the primary control connection. 680Third party file transfers depend upon support of the ftp protocol 681PASV command by the server on the secondary control connection. 682.Tp Cx Ic put 683.Cx \&\ \& 684.Ar local-file 685.Cx \&\ \& 686.Op Ar remote-file 687.Cx 688Store a local file on the remote machine. If 689.Ar remote-file 690is left unspecified, the local file name is used 691after processing according to any 692.Ic ntrans 693or 694.Ic nmap 695settings 696in naming the remote file. File transfer uses the 697current settings for 698.Ic type , 699.Ic format , 700.Ic mode , 701and 702.Ic structure . 703.Tp Ic pwd 704Print the name of the current working directory on the remote 705machine. 706.Tp Ic quit 707A synonym for 708.Ic bye . 709.Tp Cx Ic quote 710.Cx \&\ \& 711.Ar crg1 arg2 ... 712.Cx 713The arguments specified are sent, verbatim, to the remote FTP 714server. 715.Tp Cx Ic recv 716.Cx \&\ \& 717.Ar remote-file 718.Cx \&\ \& 719.Op Ar local-file 720.Cx 721A synonym for get. 722.Tp Cx Ic reget 723.Cx \&\ \& 724.Ar remote-file 725.Cx \&\ \& 726.Op Ar local-file 727.Cx 728Reget acts like get, except that if 729.Ar local-file 730exists and is 731smaller than 732.Ar remote-file , 733.Ar local-file 734is presumed to be 735a partially transferred copy of 736.Ar remote-file 737and the transfer 738is continued from the apparent point of failure. This command 739is useful when transferring very large files over networks that 740are prone to dropping connections. 741.Tp Cx Ic remotehelp 742.Cx \&\ \& 743.Op Ar command-name 744.Cx 745Request help from the remote FTP server. If a 746.Ar command-name 747is specified it is supplied to the server as well. 748.Tp Cx Ic remotestatus 749.Op Ar file-name 750.Cx 751With no arguments, show status of remote machine. If 752.Ar file-name 753is specified, show status of 754.Ar file-name 755on remote machine. 756.Tp Cx Ic rename 757.Cx \&\ \& 758.Op Ar from 759.Cx \&\ \& 760.Op Ar to 761.Cx 762Rename the file 763.Ar from 764on the remote machine, to the file 765.Ar to . 766.Tp Ic reset 767Clear reply queue. 768This command re-synchronizes command/reply sequencing with the remote 769ftp server. 770Resynchronization may be necessary following a violation of the ftp protocol 771by the remote server. 772.Tp Cx Ic restart 773.Cx \&\ \& 774.Ar marker 775.Cx 776Restart the immediately following 777.Ic get 778or 779.Ic put 780at the 781indicated 782.Ar marker . 783On UNIX systems, marker is usually a byte 784offset into the file. 785.Tp Cx Ic rmdir 786.Cx \&\ \& 787.Ar directory-name 788.Cx 789Delete a directory on the remote machine. 790.Tp Ic runique 791Toggle storing of files on the local system with unique filenames. 792If a file already exists with a name equal to the target 793local filename for a 794.Ic get 795or 796.Ic mget 797command, a ".1" is appended to the name. 798If the resulting name matches another existing file, 799a ".2" is appended to the original name. 800If this process continues up to ".99", an error 801message is printed, and the transfer does not take place. 802The generated unique filename will be reported. 803Note that 804.Ic runique 805will not affect local files generated from a shell command 806(see below). 807The default value is off. 808.Tp Cx Ic send 809.Cx \&\ \& 810.Ar local-file 811.Cx \&\ \& 812.Op Ar remote-file 813.Cx 814A synonym for put. 815.Tp Ic sendport 816Toggle the use of PORT commands. By default, 817.Nm ftp 818will attempt to use a PORT command when establishing 819a connection for each data transfer. 820The use of PORT commands can prevent delays 821when performing multiple file transfers. If the PORT 822command fails, 823.Nm ftp 824will use the default data port. When the use of PORT 825commands is disabled, no attempt will be made to use 826PORT commands for each data transfer. This is useful 827for certain FTP implementations which do ignore PORT 828commands but, incorrectly, indicate they've been accepted. 829.Tp Cx Ic site 830.Cx \&\ \& 831.Ar arg1 arg2 ... 832.Cx 833The arguments specified are sent, verbatim, to the remote FTP 834server as a SITE command. 835.Tp Cx Ic size 836.Cx \&\ \& 837.Ar file-name 838.Cx 839Return size of 840.Ar file-name 841on remote machine. 842.Tp Ic status 843Show the current status of 844.Nm ftp . 845.Tp Cx Ic struct 846.Cx \&\ \& 847.Op Ar struct-name 848.Cx 849Set the file transfer 850.Ar structure 851to 852.Ar struct-name . 853By default \*(Lqstream\*(Rq structure is used. 854.Tp Ic sunique 855Toggle storing of files on remote machine under unique file names. 856Remote ftp server must support ftp protocol STOU command for 857successful completion. 858The remote server will report unique name. 859Default value is off. 860.Tp Ic system 861Show the type of operating system running on the remote machine. 862.Tp Ic tenex 863Set the file transfer type to that needed to 864talk to TENEX machines. 865.Tp Ic trace 866Toggle packet tracing. 867.Tp Cx Ic type 868.Cx \&\ \& 869.Op Ar type-name 870.Cx 871Set the file transfer 872.Ic type 873to 874.Ar type-name . 875If no type is specified, the current type 876is printed. The default type is network ASCII. 877.Tp Cx Ic umask 878.Cx \&\ \& 879.Op Ar newmask 880.Cx 881Set the default umask on the remote server to 882.Ic newmask . 883If 884.Ic newmask 885is ommitted, the current umask is printed. 886.Tp Cx Ic user 887.Cx \&\ \& 888.Ar user-name 889.Cx \&\ \& 890.Op Ar password 891.Cx \&\ \& 892.Op Ar account 893.Cx 894Identify yourself to the remote FTP server. If the 895password is not specified and the server requires it, 896.Nm ftp 897will prompt the user for it (after disabling local echo). 898If an account field is not specified, and the FTP server 899requires it, the user will be prompted for it. 900If an account field is specified, an account command will 901be relayed to the remote server after the login sequence 902is completed if the remote server did not require it 903for logging in. 904Unless 905.Nm ftp 906is invoked with \*(Lqauto-login\*(Rq disabled, this 907process is done automatically on initial connection to 908the FTP server. 909.Tp Ic verbose 910Toggle verbose mode. In verbose mode, all responses from 911the FTP server are displayed to the user. In addition, 912if verbose is on, when a file transfer completes, statistics 913regarding the efficiency of the transfer are reported. By default, 914verbose is on. 915.Tp Cx Ic ? 916.Cx \&\ \& 917.Op Ar command 918.Cx 919A synonym for help. 920.Tp 921.Pp 922Command arguments which have embedded spaces may be quoted with 923quote (") marks. 924.Sh "ABORTING A FILE TRANSFER" 925To abort a file transfer, use the terminal interrupt key 926(usually Ctrl-C). 927Sending transfers will be immediately halted. 928Receiving transfers will be halted by sending a ftp protocol ABOR 929command to the remote server, and discarding any further data received. 930The speed at which this is accomplished depends upon the remote 931server's support for ABOR processing. 932If the remote server does not support the ABOR command, an "ftp>" 933prompt will not appear until the remote server has completed 934sending the requested file. 935.Pp 936The terminal interrupt key sequence will be ignored when 937.Nm ftp 938has completed any local processing and is awaiting a reply 939from the remote server. 940A long delay in this mode may result from the ABOR processing described 941above, or from unexpected behavior by the remote server, including 942violations of the ftp protocol. 943If the delay results from unexpected remote server behavior, the local 944.Nm ftp 945program must be killed by hand. 946.Sh "FILE NAMING CONVENTIONS" 947Files specified as arguments to 948.Nm ftp 949commands are processed according to the following rules. 950.Tw Fl 951.Tp \&1) 952If the file name \*(Lq\-\*(Rq is specified, the 953.Ar stdin 954(for reading) or 955.Ar stdout 956(for writing) is used. 957.Tp \&2) 958If the first character of the file name is \*(Lq\*(Rq, the 959remainder of the argument is interpreted as a shell command. 960.Nm Ftp 961then forks a shell, using 962.Xr popen 3 963with the argument supplied, and reads (writes) from the stdout 964(stdin). If the shell command includes spaces, the argument 965must be quoted; e.g. \*(Lq" ls -lt"\*(Rq. A particularly 966useful example of this mechanism is: \*(Lqdir more\*(Rq. 967.Tp \&3) 968Failing the above checks, if ``globbing'' is enabled, 969local file names are expanded 970according to the rules used in the 971.Xr csh 1 ; 972c.f. the 973.Ic glob 974command. 975If the 976.Nm ftp 977command expects a single local file ( .e.g. 978.Ic put ) , 979only the first filename generated by the "globbing" operation is used. 980.Tp \&4) 981For 982.Ic mget 983commands and 984.Ic get 985commands with unspecified local file names, the local filename is 986the remote filename, which may be altered by a 987.Ic case , 988.Ic ntrans , 989or 990.Ic nmap 991setting. 992The resulting filename may then be altered if 993.Ic runique 994is on. 995.Tp \&5) 996For 997.Ic mput 998commands and 999.Ic put 1000commands with unspecified remote file names, the remote filename is 1001the local filename, which may be altered by a 1002.Ic ntrans 1003or 1004.Ic nmap 1005setting. 1006The resulting filename may then be altered by the remote server if 1007.Ic sunique 1008is on. 1009.Tp 1010.Sh "FILE TRANSFER PARAMETERS" 1011The FTP specification specifies many parameters which may 1012affect a file transfer. The 1013.Ic type 1014may be one of \*(Lqascii\*(Rq, \*(Lqimage\*(Rq (binary), 1015\*(Lqebcdic\*(Rq, and \*(Lqlocal byte size\*(Rq (for PDP-10's 1016and PDP-20's mostly). 1017.Nm Ftp 1018supports the ascii and image types of file transfer, 1019plus local byte size 8 for 1020.Ic tenex 1021mode transfers. 1022.Pp 1023.Nm Ftp 1024supports only the default values for the remaining 1025file transfer parameters: 1026.Ic mode , 1027.Ic form , 1028and 1029.Ic struct . 1030.Sh "THE .netrc FILE" 1031The 1032.Pa .netrc 1033file contains login and initialization information 1034used by the auto-login process. 1035It resides in the user's home directory. 1036The following tokens are recognized; they may be separated by spaces, 1037tabs, or new-lines: 1038.Tw password 1039.Tp Cx Ic machine 1040.Cx \&\ \& 1041.Ar name 1042.Cx 1043Identify a remote machine name. 1044The auto-login process searches the .netrc file for a 1045.Ic machine 1046token that matches the remote machine specified on the 1047.Nm ftp 1048command line or as an 1049.Ic open 1050command argument. 1051Once a match is made, the subsequent .netrc tokens are processed, 1052stopping when the end of file is reached or another 1053.Ic machine 1054or a 1055.Ic default 1056token is encountered. 1057.Tp Ic default 1058This is the same as 1059.Ic machine 1060.Ar name 1061except that 1062.Ic default 1063matches any name. 1064There can be only one 1065.Ic default 1066token, and it must be after all 1067.Ic machine 1068tokens. 1069This is normally used as: 1070.Dl default login anonymous password user@site 1071thereby giving the user 1072.Ar automatic 1073anonymous ftp login to 1074machines not specified in 1075.Pa .netrc . 1076This can be overridden 1077by using the 1078.Fl n 1079flag to disable auto-login. 1080.Tp Cx Ic login 1081.Cx \&\ \& 1082.Ar name 1083.Cx 1084Identify a user on the remote machine. 1085If this token is present, the auto-login process will initiate 1086a login using the specified name. 1087.Tp Cx Ic password 1088.Cx \&\ \& 1089.Ar string 1090.Cx 1091Supply a password. 1092If this token is present, the auto-login process will supply the 1093specified string if the remote server requires a password as part 1094of the login process. 1095Note that if this token is present in the 1096.Pa .netrc 1097file for any user other 1098than 1099.Ar anonymous , 1100.Nm ftp 1101will abort the auto-login process if the 1102.Pa .netrc 1103is readable by 1104anyone besides the user. 1105.Tp Cx Ic account 1106.Cx \&\ \& 1107.Ar string 1108.Cx 1109Supply an additional account password. 1110If this token is present, the auto-login process will supply the 1111specified string if the remote server requires an additional 1112account password, or the auto-login process will initiate an 1113ACCT command if it does not. 1114.Tp Cx Ic macdef 1115.Cx \&\ \& 1116.Ar name 1117.Cx 1118Define a macro. 1119This token functions like the 1120.Nm ftp 1121.Ic macdef 1122command functions. 1123A macro is defined with the specified name; its contents begin with the 1124next 1125.Pa .netrc 1126line and continue until a null line (consecutive new-line 1127characters) is encountered. 1128If a macro named 1129.Ic init 1130is defined, it is automatically executed as the last step in the 1131auto-login process. 1132.Tp 1133.Sh ENVIRONMENT 1134.Nm Ftp 1135makes use of the 1136.Ev HOME 1137and 1138.Ev SHELL 1139environment variables. 1140.Sh SEE ALSO 1141.Xr ftpd 8 1142.Sh HISTORY 1143.Nm Ftp 1144appeared in 4.2 BSD. 1145.Sh BUGS 1146Correct execution of many commands depends upon proper behavior 1147by the remote server. 1148.Pp 1149An error in the treatment of carriage returns 1150in the 4.2BSD UNIX ascii-mode transfer code 1151has been corrected. 1152This correction may result in incorrect transfers of binary files 1153to and from 4.2BSD servers using the ascii type. 1154Avoid this problem by using the binary image type. 1155