Lftp Use Feeling

Source: Internet
Author: User
Tags ftp site

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

Code:
Help command name

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
Code:
Mget-c *.pdf

Download all PDF files in a way that allows a breakpoint to be continued. M stands for Multi
Code:
Mirror aaa/

Download the entire AAA catalog and the subdirectories will be copied automatically
Code:
PGET-C-N File.dat

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:
Code:
Bookmark Add USTC

You can store the FTP site currently being browsed with USTC as a label. After the shell terminal, direct
Code:
Lftp USTC

You can automatically fill in the user name, password, into the corresponding directory.
Code:
Bookmark Edit

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.

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: info-contact@alibabacloud.com 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.