Basic usage of FTP command

Time:2021-12-1

FTP command is one of the most frequently used commands by Internet users. Whether using FTP under DOS or UNIX operating system, you will encounter a large number of FTP internal commands. Familiar with and flexible application of FTP internal commands can greatly facilitate users and get twice the result with half the effort. Next, take the FTP command in the DOS window of Win9x as an example to introduce its usage. (Note: if you want to use FTP command under pure DOS, you need to load the packet driver of network devices such as network card or modem, and then use wattcp in the “network tools” of this site   FTP program, its usage is similar to that described below. For details, see the “Dos use” column of this site)

    The command line format of FTP is:   ftp  – v  – d  – i  – n  – g   [hostname]  , among
     – v   Display all response information of the remote server;
     – n   Restrict the automatic login of FTP, that is, do not use it;
     . n   ETRC file;
     – d   Commissioning mode;
     – g   Cancel global file name.
    The internal commands used by FTP are as follows (brackets indicate options):
1.! [CMD [args]: execute the interactive shell in the local machine and exit back to the FTP environment, such as:! LS *. Zip
2.$   macro-ame[args]:   Execute macro to define macro name.
3.account[password]:   Provide the supplementary password required to access system resources after successful login to the remote system.
4.append   Local file [remote file]: append the local file to the remote system host. If the remote system file name is not specified, the local file name will be used.
5. ASCII: use ASCII type transmission mode.
6. Bell: the computer rings once after each command is executed.
7. Bin: use binary file transfer mode.
8. Bye: exit the FTP session.
9. Case: when using mget, convert uppercase to lowercase letters in the file name of the remote host.
10.cd   Remote dir: enter the remote host directory.
11. Cdup: enter the parent directory of the remote host directory.
12.chmod   mode   File name: set the access method of the remote host file file name to mode, such as Chmod   seven hundred and seventy-seven   a.out。
13. Close: interrupt the FTP session with the remote server (corresponding to open).
14. Cr: when transferring files in asscii mode, carriage return and line feed are converted to line return.
15.delete   Remote file: delete the remote host file.
16. Debug [debug value]: set the debugging method,   Displays each command sent to the remote host, such as DEB   up   3. If it is set to 0, it means to cancel debugging.
17. Dir [remote dir] [local file]: display the remote host directory and store the results in the local file local file.
18. Disconnection: the same as close.
19.form   Format: set the file transfer mode to format, and the default is file mode.
20.get   remote-file[local-file]:   Transfer the remote file of the remote host to the local file of the local hard disk.
21. Glob: set the file name extension of mdelete, mget and mput. By default, the file name is not extended, which is the same as the – g parameter on the command line.
22. Hash: a hash symbol (#) is displayed every 1024 bytes transmitted.
23. Help [CMD]: displays help information of FTP internal command CMD, such as help   get。
24. Idle [seconds]: set the sleep timer of the remote server to [seconds] seconds.
25. Image: sets the binary transmission mode (the same as binary).
26. LCD [dir]: switch the local working directory to dir.
27. LS [remote dir] [local file]: displays the remote directory remote dir,   And save it to the local file local file.
28.macdef   Macro name: defines a macro. When an empty line under macdef is encountered, the macro definition ends.
29. Mdelete [remote file]: delete the remote host file.
30.mdir   remote-files   Local file: similar to dir, but multiple remote files can be specified, such as mdir  *. o.*.zipoutfile  。
31.mget   Remote files: transfer multiple remote files.
32.mkdir   Dir Name: create a directory in the remote host.
33.mls   remote-file   Local file: the same as nlist, but multiple file names can be specified.
34. Mode [modename]: set the file transfer method to modename,   The default is stream mode.
35.modtime   File name: displays the last modification time of the remote host file.
36.mput   Local file: transfer multiple files to the remote host.
37.newer   file-name:   If the modification time of file name in the remote machine is more recent than that of the file with the same name on the local hard disk, retransmit the file.
38. Nlist [remote dir] [local file]: displays the file list of the remote host directory and stores it in the local file of the local hard disk.
39.nmap[inpattern   Outpattern]: set the file name mapping mechanism,   During file transmission, some characters in the file are converted to each other,   For example: nmap  $ 1. $2. $3 [$1, $2]. [$2, $3], when transferring the file a1.a2.a3, the file name becomes A1, A2.   This command is especially applicable when the remote host is a non UNIX machine.
40. Ntrans [inchars [outchars]: set the translation mechanism of file name characters, such as ntrans1r, and the file name LLL will become RRR.
41.open   Host [port]: establish a connection to the specified FTP server. You can specify the connection port.
42. Passive: enter the passive transmission mode.
43. Prompt: set the interactive prompt when transferring multiple files.
44.proxy   FTP CMD: execute an FTP command in the secondary control connection,   This command allows you to connect two FTP servers to transfer files between the two servers. The first FTP command must be open to establish a connection between the two servers first.
45.put   Local file [remote file]: transfer the local file to the remote host.
46. PWD: displays the current working directory of the remote host.
47. Quit: same as bye, exit the FTP session.
48.quote   Arg1, arg2…: send parameters word by word to the remote FTP server, such as: quote   syst.
49.recv   Remote file [local file]: the same as get.
50.reget   Remote file [local file]: similar to get,   However, if the local file exists, the transmission will be continued from the last transmission interruption.
51. Rhelp [CMD name]: request help from the remote host.
52. Rstatus [file name]: if no file name is specified, the status of the remote host will be displayed,   Otherwise, the file status is displayed.
53. Rename [from] [to]: change the file name of the remote host.
54. Reset: clear the answer queue.
55.restart   Marker: restart get or put from the specified marker, such as restart   130。
56.rmdir   Dir Name: delete the remote host directory.
57. Runique: set the file name uniqueness storage. If the file exists, the suffix. 1,. 2, etc. will be added to the original file.
58.send   Local file [remote file]: the same as put.
59. SendPort: sets the use of the port command.
60.site   Arg1, arg2…: send parameters verbatim to the remote FTP host as a site command.
61.size   File name: displays the file size of the remote host, such as site   idle   7200。
62. Status: displays the current FTP status.
63. Struct [struct name]: set the file transfer structure to struct name,   The stream structure is used by default.
64. Sunique: set the remote host file name store to unique (corresponding to runique).
65. System: displays the operating system type of the remote host.
66. Tenex: set the file transfer type to the required type of tenex machine.
67. Tick: sets the byte counter during transmission.
68. Trace: set package tracking.
69. Type [type name]: set the file transfer type to type name, and the default is ASCII, such as type   Binary to set the binary transmission mode.
70. Umask [newmask]: set the default umask of the remote server to newmask, such as umask   three
71.user   User name [password] [account]: indicate your identity to the remote host. If you need a password, you must enter it, such as user   anonymous   [email protected]
72. Verbose: the same as the – V parameter on the command line, that is, set the detailed report method, FTP   All responses from the server will be displayed to the user, and the default is on
73.? [CMD]: same as help