Linux upload download files using lftp

Source: Internet
Author: User

Several methods of LFTP connection, the most commonly used is lftp name@site, so that you can enter the password without plaintext.

1, lftp name@site return Enter the password
2, lftp name:password@site carriage return
3, lftp site return login username password
4, lftp return open site return login username password

Lftp Upload File command

Upload a single file

The code is as follows Copy Code

Lftp webmaster@phpyuandi.com@115.47.192.146:/> put Test.txt.
Put:/root/desktop/new/test:is a directory

Multiple file uploads

The code is as follows Copy Code

Lftp webmaster@phpyuandi.com@115.47.192.146:/> mput *.txt./

Full station upload

The code is as follows Copy Code

Lftp webmaster@phpyuandi.com@115.47.192.146:/> mirror-r test./test
Total:1 directory, 2 files, 0 symlinks
New:2 files, 0 symlinks

lftp Download File command

Get Download a single file

The code is as follows Copy Code

Lftp webmaster@phpyuandi.com@115.47.192.146:/> Get html.php
8473 bytes Transferred

Select a download for some type of extension in a directory

The code is as follows Copy Code
LFTP webmaster@phpyuandi.com@115.47.192.146:/your catalogue > Mget *.php
[0] mget *.php &
' image_class.php ' at 0 (0%) [Making data Connection ...]
Mget

Breakpoint Continuous transfer function

The code is as follows Copy Code
Lftp webmaster@phpyuandi.com@115.47.192.146:/> mget-c./Your catalogue/*.*
Mget:/root/desktop/new:is a directory
[0] mget-c./Your catalogue/*.* &
' Your catalogue/business_edit.php ' at 1126 (100%) [Making data Connection ...]

Download the entire site

The code is as follows Copy Code
LFTP webmaster@phpyuandi.com@115.47.192.146:/> Mirror/
[0] Mirror/&

Download the entire Directory

The code is as follows Copy Code

LFTP webmaster@phpyuandi.com@115.47.192.146:/> Mirror Your catalogue/
[1] Mirror your catalogue/&

Breakpoint continues to pass the entire directory

The code is as follows Copy Code

Lftp webmaster@phpyuandi.com@115.47.192.146:/> Mget-c your catalogue/*
[0] Mget-c your catalogue/* &
' Your catalogue/info_class.php ' at 0 (0%) [Waiting for response ...]

Lftp Find File command

LS *.php find the current directory of PHP files

The code is as follows Copy Code
Lftp webmaster@phpyuandi.com@115.47.192.146:/> ls *.php
Total 16
-RW-------1 www. www. 2037 Nov 07:50 cai.php
-rw-r--r--1 www. 8473 Oct 07:52 html.php

ls./admin/find files in the admin directory

The code is as follows Copy Code
Lftp webmaster@phpyuandi.com@115.47.192.146:/> ls./admin/
Total 444
-rw-r--r--1 www. www. 611 Aug 2 08:46 application.php
-rw-r--r--1 www. www. 391 Aug 2 08:47 application_info.php
-rw-r--r--1 www. www. 858 Aug 6 08:00 banner.php
-rw-r--r--1 www. www. 650 Aug 2 08:45 banner_add.php
-rw-r--r--1 www. www. 1026 Aug 2 08:45 banner_edit.php
-rw-r--r--1 www. www. 1434 Aug 6 08:03 business.php
-rw-r--r--1 www. www. 788 Aug 3 10:01 business_add.php
-rw-r--r--1 www. www. 277 Aug 3 10:01 business_bigclass_add.php
-rw-r--r--1 www. www. 473 Aug 3 10:00 business_bigclass_edit.php
-rw-r--r--1 www. www. 484 Aug 3 10:00 business_class.php
-rw-r--r--1 www. www. 234 Aug 3 09:59 business_class_del.php
-rw-r--r--1 www. www. 1126 Aug 3 09:59 business_edit.php
-rw-r--r--1 www. www. 759 Aug 3 09:58 business_smallclass_add.php
-rw-r--r--1 www. www. 871 Aug 3 10:10 business_smallclass_edit.php
-rw-r--r--1 www. www. 44402 Aug cai.php
-rw-r--r--1 www. www. 930 Nov 07:59 check_login.php
Drwxr-xr-x 2 www. 4096 Aug 10:09 CSS
ls./admin/year*.php to find the PHP file containing year under the Admin directory
Lftp webmaster@phpyuandi.com@115.47.192.146:/> ls./admin/year*.php
Total 12
-rw-r--r--1 www. www. 651 Aug 6 07:57 year.php
-rw-r--r--1 www. www. 401 09:29 year_add.php
-rw-r--r--1 www. 531 Aug 4 year_edit.php


Common Commands

Running at terminal
Mans LFTP
or login to FTP after entering
Help
You can see the list of commands
Now let's take a look at the lftp common commands:
Ls
Displays a list of remote files (!ls displays a list of local files).
Cd
Switch remote directory (LCD switch local directory).
Get
Download the remote file.
Mget
Download the remote file (you can use the wildcard character, which is *).
Pget
Use multiple threads to download the remote file, preset to five.
Mirror
Download/upload (mirror-r)/Synchronize the entire directory.
Put
Upload files.
Mput
Upload multiple files (wildcard characters are supported).
Mv
Move remote file (remote file renamed).
Rm
Deletes a remote file.
Mrm
Delete multiple remote files (wildcard characters are supported).
Mkdir
Create a remote directory.
RmDir
Deletes the remote directory.
Pwd
Displays the current remote directory (LPWD displays the local directory).
Du
Calculate the size of the remote directory
!
Executes the command of the local shell (because lftp is not lls, it can be replaced by!ls)
Lcd
Toggle Local Directory
Lpwd
Show Local Directory
Alias
Define Alias
Bookmark
Set the bookmark.
Exit
Exit FTP
Shortcut bookmarks

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.