Detailed explanation of the use of FTP under the command line

The following are simple steps and command instructions

Suppose there is a target FTP server, IP: 123.123.123.123, username: ftpname, password: ftppwd. Currently, upload file.doc in the D:\ftpin directory to the target server through the command line. The steps to download from the server are as follows:

  1. "Start"-"Run"-enter "FTP" (this is P words)

  2. open 123.123.123.123

This step can be combined with the first step, directly enter "ftp 123.123.123.123" in "Run". If your FTP server is not using the default port 21, if the port is 12333, then the command in this step should add 12333 after the space, that is, "open 123.123.123.123 12333"

  1. ftpname

The command line will prompt you to enter the user name, and the prompts may be different for different OS versions (XP, Vista, Win7)

  1. ftppwd

You are prompted to enter the password. It will not display or move the cursor during the password input process. Just press Enter after typing the password. If your password is entered incorrectly, you will not be prompted to re-enter it. At this time, you have to type the "user" command, and the third step will appear where you can re-enter your username and password.

  1. to you

After you successfully log in, you can use the dir view command to view the files and directories in the FTP server, and the ls command can only view files.

  1. mkdir rsfile

Create an rsfile directory under the root directory on the FTP server.

  1. cd rsfile

Enter the directory rsfile, and use "cd your directory name" to enter the next level of the current directory, which is the same as DOS.

  1. bin

Use binary transmission. If you want to upload and download, this step is very important. If you don't execute this command first, upload and download will be slow.

  1. lcd D:\ftpin

Locate the local default folder. The lcd command here is similar to the cd under the usual command line

  1. !to you

View files and directories in local folders

  1. put file.doc

Upload the file file.doc in the current directory (D:\ftpin) to the default directory of the FTP server. You can use "mput . " to upload all files to the FTP server.

  1. get aaa.jpg

Download the file aaa.jpg in the default directory of the FTP server to the current directory (D:\ftpin). You can use "mget . " to download all files to D:\ftpin*/

  1. delete

Delete all files in the directory ftpin.

  1. cd

Return to the upper level directory, that is, the root directory. To return to the upper level directory, use "cd …" to note that there is a space in the middle. Use "cd \" to return to the root directory.

  1. mrdir ftpin

Delete the directory ftpin. Delete the directory, there can be no files and directories in this directory, otherwise it will not be deleted.

  1. bye

Log out of the FTP server

When uploading and downloading, pay special attention to the current directory of the server and local computer, and the issue of where the file is from. The command to view the current directory of the FTP server is pwd, and you can use the cd command to locate the server's directory. You can use the lcd command to locate the directory of the local computer. The above examples are applied to the most commonly used commands for uploading and downloading using FTP command line mode. You can also use the command "?" to view more commands.

Forward blog link

Guess you like

Origin blog.csdn.net/qq_37469055/article/details/96427103