Linux FTP command

Source: Internet
Author: User
Tags exit in glob runique

What is the difference between anftp get command and a mget command ?

get Download only one file at a time, mget can download more than one file at a time, and support wildcard characters, it is necessary to note that in mget, you need to choose y/n for each file, if you want not to interactively download all the files, you can first use the prompt command Turn off interactive mode (off: Prompt off; open: Prompt On).

Ii. what command doesFTP use to locate the path of the server and local hard disk?

In FTP , switch the local path with the LCD and switch the path of the remote server with the CD. The commands that are commonly used are as follows:

CD directory name (enter server directory) LCD directory name (enter the local directory)

CD \ (back to the server root) LCD \ (back to the local root directory)

Cd.. (Back to previous level) LCD. (Back to previous level)

Three! What is the purpose of the order ?

Executes local shell commands , such as:!dir (show native when pro directory content), if not added! For example: Dir (displays the current directory contents of the server)

Does theFTP command support a folder/file name that contains spaces?

Support, as long as the reference with double quotation marks "" Can!

Five, the following is the command -line method of using FTP Practical Practice

Suppose you have an FTP server:ftp., User name: username, password: user1234. Create a folder "Qint" on the local computer D: disk. Copy the file you want to upload to D:\qint. To upload files locally from the FTP command , download the following steps from the server:

1, "start" → "Run" → enter "FTP"

2, open ftp.

Note: This step can be combined with the first step to enter directly in "Run":FTP ftp. If your FTP server is not using the 21 default port, if the port is 2121, then this step of the command should be in the following space plus 2121, that is, "open FTP.

3, username
Note: You are prompted to enter a user name

4, user1234
Note: Prompts you to enter the password, the password does not echo, after playing the password to return. If your password is entered incorrectly, you will not be prompted to re-enter, then you will type "user" command , the third step appears, you can re-enter the user name and password.

5. Dir
Note: After you have successfully logged in, you can view the files and directories in the FTP server with the dir View command , and you can only view the files with the LS command .

6, mkdir Qint
Note: The Qint directory is established under the root directory on the FTP server

7. CD Qint
Note: Enter the directory Qint, with "CD your directory name" can go to the current directory of the next level of directory, this is the same as DOS.

8. Bin

Note: Binary transfer is in use. If you want to upload the download, this step is very important, do not first execute this command , upload download will be very slow. Most systems, including UNIX systems, have only two modes: text mode and binary mode. Text transmitters use ASCII characters and are separated by return and newline characters, binary mode is faster than text mode, and all ASCII values can be transferred, so system administrators typically set FTP to binary mode instead of converting or formatting. Generally speaking, we'd better use binary mode, so that we can ensure that there is no error.

9, LCD D:\qint

Note: Locate the local default folder, which was previously created in the D: disk


Note: View files and directories in the local folder

11. Put I001.jpg
Note: Upload the file i001.jpg in the current directory (D:\qint) to the FTP Server default directory. You can upload all files to the FTP server with "Mput * *".

12.Get d123.jpg
Note: Download the file d123.jpg in the FTP Server default directory to the current directory (D:\qint). You can download all files to d:\qint with "Mget * *"

13. Delete * *

Note: Delete all the files in the server's corresponding directory qint.

14. cd.

Note: Go back to the top level directory, which is the root directory. Go back to the previous directory with "CD.." Be aware that there are spaces in the middle. Return the root directory with "CD \".

15, Mrdir Qint

Note: Delete the directory qint. Delete the directory, you cannot have files and directories in this directory, or it will not be deleted.

16, bye

Note: Exit the FTP server.

When uploading the download, pay special attention to the server and the local computer's current directory, the file is from where to where the problem. To view the FTP server's current directory command for PWD, you can use the CD command to locate the server's directory. You can use the LCD command to locate the local computer's directory.

The above example applies to the most commonly used commands for uploading and downloading using the FTP command line, you can also use the command "? "To see more commands .

ftp commands are one of the most frequently used commands for Internet users, whether using ftp under a DOS or Unix operating system, Will encounter a large number of FTP internal commands . The familiar and flexible application of FTP internal commands , can greatly facilitate users, and receive a multiplier effect.
the command line format for FTP is:ftp -v-d-i-n-G [hostname], where
-V Displays all the response information for the remote server;
- N Limit ftp automatic login, that is, do not use;
. n etrc file;
- D use debug mode;
-G cancels the global file name.
the internal commands used by FTP are as follows (brackets indicate options):
1.! [Cmd[args]]: Perform interactive shell,exit in the local machine back to the FTP environment, such as:!ls*.zip.
2.$ Macro-ame[args]: Executes the macro definition Macro-name.
3.account[password]: Provides the supplemental password required to access system resources after a successful logon to the remote system.
4.append Local-file[remote-file]: Appends the local file to the remote system host and uses the local file name if the remote system file name is not specified.
5.ascii: Use ASCII type transfer mode.
6.bell: The computer rings once after each command is executed.
7.bin: Use a binary file transfer method.
8.bye: Exits the FTP session process. When using Mget, capitalize the remote host file name into lowercase letters. remote-dir: Enter the remote host directory.
11.cdup: Enter the parent directory of the remote host directory.
12.chmod Mode file-name: Sets the remote host file File-name access mode to mode, such as: chmod 777 a.out.
13.close: Interrupts the FTP session with the remote server (corresponding to open). When you transfer a file using Asscii, the carriage return line is converted to a return line.
15.delete remote-file: Delete the remote host file.
16.debug[debug-value]: Set debug mode, display each command sent to the remote host, such as: Deb up 3, if set to 0, means cancel Debug.
17.dir[remote-dir][local-file]: Displays the remote host directory and stores the results in local file local-file.
18.disconnection: Same as close.
19.form Format: Sets the file transfer mode to format, which is the default.
get remote-file[local-file]: Transfer the remote host's file Remote-file to the local-file of the local hard disk.
21.glob: Set mdelete,mget,mput file name extension, by default, does not extend the file name, the same as the command line-G parameter.
22.hash: 1024 bytes per transmission, showing a hash symbol (#).[cmd]: Displays help information for the FTP internal command cmd, such as: get.
24.idle[seconds]: Set the remote server's sleep timer to [seconds] seconds.
25.image: Set binary transfer mode (same binary).
26.lcd[dir]: Switch the local working directory to dir.[remote-dir][local-file]: Displays the remote directory Remote-dir and stores the local file Local-file.
28.macdef Macro-name: Defines a macro that, when encountered with empty lines under Macdef, ends the macro definition.
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: Build a directory in the remote host. remote-file local-file: Same as nlist, but multiple file names can be specified.
34.mode[modename]: Set the file transfer mode to Modename, the default is stream mode.
35.modtime file-name: Displays the last modified time of the remote host file.
36.mput local-file: Transfers multiple files to a remote host.
37.newer File-name: If the file-name in the remote machine is modified more closely than the local hard disk file with the same name, the file is re-transmitted.
38.nlist[remote-dir][local-file]: Displays the list of files for the remote host directory and deposits the local-file of the local hard disk.
39.nmap[inpattern Outpattern]: Sets the file name Mapping mechanism, so that when files are transferred, some characters in the file are converted to each other, such as: Nmap $1.$2.$3[$1,$2]. [$2,$3], when the file a1.a2.a3 is transferred, the filename becomes a1,a2. This command is especially useful for cases where the remote host is not a UNIX machine.
40.ntrans[inchars[outchars]]: Sets the translation mechanism of the filename character, such as Ntrans 1R, then the file name LLL becomes the RRR. Host[port]: establishes the specified FTP server connection and can specify the connection port.
42.passive: Enter passive transmission mode.
43.prompt: Interactive tips for setting up multiple file transfers.
44.proxy ftp-cmd: In the secondary control connection, execute an ftp command that allows two ftp servers to be connected. To transfer files between two servers. The first ftp command must be open to establish a connection between two servers first.
45.put Local-file[remote-file]: Transfers The local file Local-file to the remote host.
46.pwd: Displays the current working directory of the remote host.
47.quit: With bye, exit the FTP session.
48.quote arg1,arg2 ... : The parameters are sent verbatim to the remote FTP server, such as: Quote Syst.
49.recv Remote-file[local-file]: Same as get.
50.reget Remote-file[local-file]: Similar to get, but if local-file exists, it is resumed from the last transmission interrupt.
51.rhelp[cmd-name]: Request help for remote host.
52.rstatus[file-name]: If the file name is not specified, the status of the remote host is displayed, otherwise the file status is displayed.
53.rename[from][to]: Change the remote host file name.
54.reset: Clears the answer queue.
55.restart marker: From the specified flag marker, restart get or put, such as: Restart 130.
56.rmdir dir-name: Deletes the remote host directory.
57.runique: Set file name Uniqueness Store, if the file exists, then add suffix after the original file. 1,.2 and so on.
58.send Local-file[remote-file]: same put.
59.sendport: Set the use of the Port command . arg1,arg2 ... : sends the parameter verbatim to the remote FTP host as the site command .
61.size file-name: Displays the remote host file size, such as: Site Idle 7200.
62.status: Displays the current FTP status.
63.struct[struct-name]: Sets the file transfer structure to struct-name, using the stream structure 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 desired type of the Tenex machine.
67.tick: Sets the byte counter at transfer time.
68.trace: Set up Package tracking.
69.type[type-name]: Set the file Transfer type to Type-name, default to ASCII, such as: Type binary, set the binary transfer mode.
70.umask[newmask]: Set the remote server's default umask to Newmask, such as: Umask 3.
71.user User-name[password][account]: to indicate your identity to a remote host, you must enter a password when you need a password, such as: User anonymous [email protected].
72.verbose: With the command line of the-v parameter, that is, set the detailed reporting method, theFTP server All the response will be displayed to the user, the default is on.
73.? [cmd]: With help.

assume that the FTP address is "" (everyone try not to use this ftp to test, it should be possible to get rid of the password.) )
1: "Start"-"Run"-enter "FTP" in the cmd interface
If your FTP server is not using the 21 default port, if the port is 9900, then this step of the command should be in the following space plus 9900, that is, open 9900
3: It will prompt for user name username
4: It will prompt you to enter your password: password
Note that the password does not show up, after the password to enter. If your password is entered incorrectly, you will not be prompted to re-enter, you can simply type the "user" command , you will be able to re-enter the username and password.
5: After the successful login can use the dir view command to view the FTP server files and directories, with the LS command can only view files.
6: Use the CD command to go to the directory, delete delete files, the usage is similar to DOS . Oh!!
7:LCD d:dianying Locate the local default folder (I understand that the L here is local English abbreviation, very good understanding and memory)
8: The next side is to upload and download the file command , upload with put file name. Download with get file name
of course it's in the current directory, which is the "d:dianying" defined above.
9: Finally, I quit.
Use the bye command .
FTP[-V] [-d] [-I.] [-N] [-G] [-s:filename] [-A] [-w:windowsize] [-A] [Host]

Suppress displayFTPServer Response.
Enable debugging, display inFTPClient andFTPAll the messages passed between the serversCommand
Disables interactive prompting when transferring multiple files.
Disables the automatic login function after initial connection is established.
Disables file name combinations. Glob allows you to use the asterisk (*) and question mark (?) as local files and path names
A wildcard character.
Specifies the containingFTP CommandText file. TheseCommandIn the startFTPAutomatically run after it. This parameter does not
Allowed with spaces. Use this parameter instead of redirection (<).
Specifying bindingsFTP . &NBSP;
   Specifies the size of the transport buffer. The default window size is 4096 bytes. &NBSP;
   Anonymous login to &NBSP; FTP   server. &NBSP;
   Specify the name of the computer to connect to, the IP address, or &NBSP; FTP   server. If the primary
machine name or address is specified, it must be the last parameter of the command line. &NBSP;
/?    Display Help under command prompt .
Common Commands :
1. Open: Connect to the FTP server;
2. Send (Put): Upload files;
3. get: Download the file;
4. Mget: download multiple files;
5. CD: Switch directory;

Plus the directory and the full path

Linux FTP command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.