Recently testing the company's internal FTP server, downloading and uploading problems.
found that lftp than FTP (are the client) to be more powerful, after the use of the discovery, FTP reget command, is required before this file must exist, and another FTP breakpoint retransmission is not automatic, need manual operation.
And the use of lftp in the mget-c *.txt such commands can be automatically linked (currently only tested after network disconnect, after a long time to connect up, do not know whether the long-term network will continue to connect)
Here to paste the common commands, to facilitate their own search,
First, all the commands within the LFTP terminal can be used
Way to view the help information.
In addition, LFTP support tab automatic completion, do not remember the command is, dozen two tab, you can see the possible options.
1, Login FTP
Code: |
LFTP Username: password @ftp address: Transfer port (default 21) |
You can also log on without a username, and then login with the login command under the interface interface, and the password does not appear.
2. View file and change directory
Code: |
Ls CD corresponding FTP directory |
Hey, it's easy. In fact, in the Lftp terminal, the front with an L command such as LCD, refers to the local, is the operation of the machine, and the corresponding does not have this L, are the operation of the FTP site. Also have to execute local Terminal command, also can use the front with a! way. In this way, together, terminals, local operations are very much in place.
For example, view all files on FTP with MP3 extensions:
Code: |
Find. -name "*.mp3" |
3, download
Get of course is OK, also can
Download all PDF files in a way that allows a breakpoint to be continued. M stands for Multi
Download the entire AAA catalog and the subdirectories will be copied automatically
Download file.dat with up to 10 threads to allow a breakpoint to continue
You can use the default value by setting the value of the pget:default-n.
4, Upload
The same put,mput, is the operation of the file, and download similar.
Code: |
Mirror-r Local Directory Name |
Uploads the local directory back up to the FTP site in iterations, including subdirectories.
5, Mode setting.
Code: |
Set Ftp:charset GBK |
Remote FTP site with GBK encoding, the corresponding to be set to UTF8, as long as the replacement GBK for UTF8 can.
Code: |
Set File:charset UTF8 |
The local charset is set to UTF8, and if you are GBK, get rid of it accordingly.
Code: |
Set Ftp:passive-mode 1 |
Use passive mode to log in, some site requirements must be in passive mode or active mode to log in, this switch is set this. 0 means no passive mode.
6. Bookmark
In fact, the command line can also have bookmarks, at the Lftp terminal prompt:
You can store the FTP site currently being browsed with USTC as a label. After the shell terminal, direct
You can automatically fill in the user name, password, into the corresponding directory.
The editor is invoked to manually modify the bookmark. Of course, you can also see that this bookmark is actually a simple text file. Password, the user name can be seen.
7. Configuration file
/etc/lftp.conf
Generally, I will add these lines:
Reference: |
Set Ftp:charset GBK Set File:charset UTF8 Set Pget:default-n 5 |
In this way, you don't have to make a command every time you enter. The other set can tab and help to see.