The use of lftp

Source: Internet
Author: User
Tags openssl library

Lftp is an FTP tool under Linux that supports FTP, FTPS, HTTP, https, hftp, fish, SFTP, file and other protocols (support for HTTPS and FTPS, which must be compiled together with the OpenSSL library). The shell-like command format is built into LFTP, allowing multiple commands (&) to be executed in the background simultaneously. All background work is performed in the same program (process), the commands that can be executed in the foreground are placed in the background execution (ctrl-z), or the foreground is executed from the background (wait or FG), or even the current command is passed back to the value of the previous command (& & | |). At the end of lftp, if there is a program in progress, LFTP will switch itself to the no Hup mode and put it on the background, so you don't have to worry about the end of the task that is being performed.

1, configuration in the use of LFTP access to some of the domestic FTP server, often see the Chinese is garbled, this is due to inconsistent server and local code. All we need to do is create a new file ~/.LFTPRC or ~/.LFTP/RC in the main directory and add the following to it:
Debug 3
Set Ftp:charset GBK
Set File:charset UTF-8
#set Ftp:passtive-mode No
#alias UTF8 "set Ftp:charset UTF-8"
#alias GBK "Set Ftp:charset GBK" 2, Login server//display bookmarks
[Email protected]:~$ lftp-c Bookmark List
NET ftp://ftp.net/
lingbookshttp://24.72.100.108/lingbooks/
Zdhz 23.65.2.16 [email protected]:~$ lftp zdhz
LFTP 23.65.2.16:~> User CB
Password://Log in to multiple FTP servers at the same time, use slots to set aliases, and switch between them
Lftp[email protected]:~> Slot Zdhz
Lftp zdhz[email protected]:~> Slot Net
Lftp Net[email protected]:~> Open Ftp.net
CD successful, current directory =/
Lftp Net ftp.net:/> slot Zdhz
Lftp zdhz[email protected]:~> Slot Net
lftp net ftp.net:/>3, download lftp zdhz[email protected]:/> CD working/
Lftp zdhz[email protected]:/working> LCD ~/tmp/
LCD success, local directory =/home/cb/tmp
Lftp zdhz[email protected]:/working> Get Kaiti.rar
1782318 bytes Transferred//Specifies the destination directory of the downloaded file, requires each file to be followed by the-o option (lowercase), otherwise uploaded to the server's current directory
Lftp[email protected]:/working> get kaiti.rar-o ~/tmp command Information System military requirements analysis. Doc-o ~/doc
1806382 bytes Transferred
Transfer 2 files in total//download multiple files with wildcard characters
Lftp zdhz[email protected]:/working> Mget *.doc
202969 bytes Transferred
A total of 6 files are transferred//specify the downloaded base directory (base), using the-o option, note that uppercase
Lftp zdhz[email protected]:/> mget ebook/source*-o ~/tmp
52511692 bytes, transfer complete in 5 seconds (10.96m/s)
Total 2 Files Transferred lftp[email protected]:/ebook> Mget 10 days to learn Php.rar programming practice. Rar-o ~/tmp/
8004043 bytes, transfer complete in 2 seconds (3.72m/s)
Total transfer of 2 files//image download Entire Directory
Lftp zdhz[email protected]:/working> Mirror Network ~/tmp/
Total: 1 directories, 9 files, 0 symbolic links
NEW: 9 files, 0 symbolic links
1453557 bytes Transferred//multi-threaded download,-o option specifies the destination directory to download, note is lowercase.
Lftp zdhz[email protected]:/> pget-n 4 ebook/source1.pdf ebook/source2.pdf-o ~/tmp
52514342 bytes, transferred in 7 seconds (7.34m/s) 4, upload//Specify the target directory to upload the required after each file with the-o option (lowercase), or upload to the server's current directory
Lftp zdhz[email protected]:/> put source1.pdf-o ebook/source2.pdf-o ebook/linux command Encyclopedia. CHM
52866871 bytes, transfer complete in 5 seconds (11.09m/s)
Transfer 3 files in total//use wildcards to upload multiple files, note: Use the-o parameter to specify the base directory to upload, uppercase
Lftp zdhz[email protected]:/> mput Source*.pdf-o ebook/
52511692 bytes, transfer complete in 4 seconds (11.14m/s)
Total transfer of 2 files//image upload entire directory, can be used for synchronization
Lftp zdhz[email protected]:/> Mirror-r ~/ebook/linux/lfs/ebook/
Total: 15 Directories, 137 files, 0 symbolic links
NEW: 137 files, 0 symbolic links
4456290 bytes, transfer complete in 6 seconds (688.9K/S)
Lftp zdhz[email protected]:/> ls ebook/
Total 0
Drw-rw-rw-1 User Group 0 Sep 28 16:50.
Drw-rw-rw-1 User Group 0 Sep 28 16:50..
Drw-rw-rw-1 User group 0 Sep 16:50 LFS5, delete files on server//delete multiple files
Lftp zdhz[email protected]:/> RM ebook/source1.pdf Linux Command encyclopedia. chm
RM successful, delete 2 files//delete entire Directory
Lftp zdhz[email protected]:/> Rm-r ebook/
RM succeeded, delete ' ebook/'//delete multiple files under a directory
Lftp zdhz[email protected]:/> MRM Ebook/*.pdf
RM successful, delete 2 files 6, Task queue for those only one IP can only log on once the server, if you want to download a number of files in different directories at the same time, you can only download one at a time, wait until the first download and then switch to another directory to download the second, then lftp queue to come in handy.
Lftp[email protected]:/pub/iso> Queue Lftp[email protected]:/pub/iso> Jobs
0 Queue (ftp://[email protected])
Queue is stopped. Lftp[email protected]:/pub/iso> Queue Get Rettcd.iso lftp[email protected].2.16:/pub/iso> Jobs
0 Queue (ftp://[email protected])
Queue is stopped.
Commands queued:1. Get Rettcd.iso lftp[email protected]:/pub/iso> Queue Mirror Linux/lftp[email protected]:/pub/iso> Jobs
0 Queue (ftp://[email protected])
Queue is stopped.
Commands queued:1. Get RETTCD.ISO2. Mirror LINUX/LFTP[email protected]:/pub/iso> Queue Start Lftp[email protected]:/pub/iso> Jobs
0 Queue (ftp://[email protected])
Now executing:1 get Rettcd.iso
Commands queued:1. Mirror LINUX/2. Get Rettcd.iso ' Rettcd.iso ' at 4772864 (9%) 3.00m/s eta:14s receiving Data summary:
    1. Common commands: CD, lcd, GET, mget, put, mput, Mirror, RM, MRM, Pget, queue, Jobs
    2. Mget, Mput, MRM can use wildcards * to match multiple files
    3. By default mirror:set-permissions on, Mirror will copy the file and directory (original) permissions, otherwise (off) use the file system to create file and directory rules to reset the file directory permissions (file 666 & umask, directory 777 & Umask), and-P (or-no-perms) is equivalent to setting the variable to off; It is recommended that the variable be set to OFF in ~/.LFTPRC: set Mirror:set-permission off
    1. -o Specifies the base directory that the mput and Mget commands upload or download, so that multiple files do not use the-O option to specify the destination path for each file.

=-=-=-=-=
Powered by Blogilo

The use of lftp

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.