FTP command, ftp command line
FTP commands are one of the most frequently used commands by Internet users. A large number of internal FTP commands are used in both DOS and UNIX operating systems. Familiar with and flexible application of FTP Internal commands can greatly facilitate users and get twice the result with half the effort. The ftp command is used to set functions related to the file system. Ftp servers are more common on the Internet. The Linuxftp command function is to use commands to control the transfer of files between local machines and remote machines, here we will introduce some frequently used Linux ftp commands in detail. I believe it will be very easy to master these ftp operations using Linux.
[For more information, see http://blog.csdn.net/mahoking]
1. command functions
FTP adopts the client/server model, and the client and server use TCP to establish a connection. On the server side, FTP has two pre-allocated port numbers: 20 and 21. port 20 is used to send and receive FTP data (ASCII code or binary files). The data port is only enabled when data transmission ends and closed when transmission ends. Port 21 is used to send and accept FTP control information. The FTP server listens on this port to determine whether there is a connection request from the ftp client. After the FTP session is established, the connection to port 21 remains open during the session.
On the client, when a request is sent, the port number is dynamically allocated. The value range is 1024 ~ 65535. when an FTP session starts, the client opens a control port (such as 1038), which is connected to port 21 on the server to receive and send control letter commands. When data needs to be transmitted, the client then opens the second port (such as 1039) and connects to Port 20 on the server. Each time a file is transmitted, the client opens a new data port, which is automatically released after the file is transferred.
2 Command Format
The command line format of FTP is: ftp [Option] [host name]
Ftp-v-d-I-n-g [host name]
3 option description
Common FTP Parameters
-G: cancels the global file name;
-D: displays the instruction execution process in detail to facilitate troubleshooting or analyzing program execution;
-I: Disable the interaction mode without asking any questions;
-G: Disable the extension feature of special characters for the local host file name;
-N: automatic logon is not used;
-V: displays the command execution process.
Common FTP Internal commands
When the client accesses FTP, if the server's host name or IP address is not provided in the command line, the client will prompt "ftp>", waiting for the user to enter the ftp internal command.
Instance:
FTP> ascii: Transfers files in ASCII mode (default ).
FTP> bell: an alarm is triggered every time a file is transferred.
FTP> binary: sets File Transfer in binary mode.
FTP> bye: Terminate the FTP process on the host and exit FTP management.
FTP> case: when it is ON, use the MGET command to copy the file name to the local machine, convert all to lowercase letters.
FTP> cd: The same as the unix cd command.
FTP> cdup: Return to the upper-level directory.
FTP> chmod: Change the File Permission of the remote host.
FTP> close: Terminate the remote FTP process and return to the FTP command status. All macro definitions are deleted.
FTP> delete: delete files from the remote host.
FTP> dir [remote-directory] [local-file] lists the files in the directory of the current remote host. If there are local files, write the results to the local file. FTP> get [remote-file] [local-file] is transferred from the remote host to the local host.
FTP> help [command] explanation of the output command.
FTP> LCD: changes the working directory of the current local host. If it is set to default, it is transferred to the HOME Directory of the current user.
FTP> ls [remote-directory] [local-file] is the same as DIR.
FTP> macdef: defines macro commands.
FTP> mdelete [remote-files] deletes a batch of files.
FTP> mget [remote-files] receives a batch of files from the remote host to the local host.
FTP> mkdirdirectory-name: create a directory on the remote host.
FTP> mputlocal-files transfers a batch of files from the local host to the remote host.
FTP> open host [port] to create a new connection.
FTP> prompt: Interactive prompt mode.
FTP> putlocal-file [remote-file] transfers a local file to the remote host.
FTP> pwd: list the directories of the current remote host.
FTP> quit: Same as BYE.
FTP> recvremote-file [local-file] is the same as GET.
FTP> rename [from] [to] Change the file name in the remote host.
FTP> rmdirdirectory-name: Delete the directory from the remote host.
FTP> sendlocal-file [remote-file] is the same as PUT.
FTP> status: displays the status of the current FTP.
FTP> system: displays the system type of the remote host.
FTP> useruser-name [password] [account] log on to the remote host with another user name.
FTP>? [Command]: Same as HELP. [command], it specifies the name of the command that requires HELP. If no command is specified, ftp displays a list Of all commands.
FTP>! Exit from the ftp subsystem to the shell.
[For more information, see http://blog.csdn.net/mahoking]