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