Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of using LFTP in Linux system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "the method of using LFTP in the Linux system". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the method of using LFTP in the Linux system".

Install Lftp

Before running lftp, we need to make sure that it is properly installed in our Linux distribution. Here are some commands to install lftp in common Linux distributions.

Ubuntu 14.04 LTS

In Ubuntu 14.04 LTS and its derivatives, we can install lftp through the apt hypervisor. To install it, we need to run the following command in shell or terminal with sudo privileges.

The code is as follows:

$sudo apt-get install lftp

CentOS/Fedora/RHEL

Because lftp can also be found in the software repositories of Fedora,CentOS and RHEL, we can use the yum manager to install it.

The code is as follows:

$sudo yum install lftp

Arch Linux

It is also available in the Arch Linux installer repository, and we can simply use pacman to install it.

The code is as follows:

$sudo pacman-S lftp

OpenSuse

The package management software Zypper in the OpenSuse system can be used to install lftp. Here are the commands used to install on the OpenSuse machine.

The code is as follows:

$sudo zypper install lftp

Log in

To log in to the ftp server or sftp server, we first need to know the required authentication information, such as user name, password, port.

After that, we can log in through lftp.

The code is as follows:

$lftp ftp://linoxide@localhost

If you need to specify the login port, we can add it as follows.

The code is as follows:

$lftp ftp://linoxide@localhost:21

Navigation

We can use the ls command to list files and directories, and use the cd command to enter the directory.

Upload and download files

We can use the pget command to download files from the remote server.

> pget linspeed.svg

We can use the put command to upload files to the remote server.

> put linoxide.tar

To recover files / directories that were only partially downloaded, we can use the-c switch:

The code is as follows:

Mirror-c Directory

Pget-c linoxide.tar

Put-c upload.tar

Use the mirror command

We can use the mirror command to download the entire directory specified.

> mirror remote local

You can also do a reverse mirror (mirror-R), which can be used to upload or update the local directory tree to the server.

> mirror-R local remote

To recover some of the previously downloaded files / directories, we can use the-c switch:

The code is as follows:

Mirror-c Directory

Download queue

We can use the queue option in lftp so that we can download the files selected in the queue one by one like GUI-based clients. Let me give you an example.

To prevent the queue from automatically starting transmission, we can do this:

The code is as follows:

> queue stop

Now, let's add tasks to the queue.

The code is as follows:

> queue mirror "directory"

> queue pget "file.tar"

After the queue is established, we run the queue start command.

The code is as follows:

> queue start

You can run the following command to remove the entire queue.

The code is as follows:

> queue-d

Block download

The following is an example of dividing a file into 3 pieces to download, which you can adjust according to your needs.

The way to use the pget command chunking function is pget-n 3 file.tar, where 3 is the number of chunks.

The code is as follows:

> pget-n 3 file.tar

The way to use the mirror command chunking function is mirror-- use-pget-n=3 directory, where 3 is the number of chunks.

The code is as follows:

> mirror-- use-pget-n=3 linxoxide

We can use the jobs-v command to see the download speed and overall speed of each individual chunk.

Stop, continue, or delete a transfer task

To cancel the transmission, we can press Ctrl+C. To resume downloads, we can use the-c (--continue) switch as shown below.

The code is as follows:

Mirror-c directory

To delete a task that is in transit, we can use the kill command, and to delete all tasks, we can use the kill all command like the following.

The code is as follows:

> kill

> kill all

Quit

To exit from lftp, we need to run the exit command on the terminal or in the lftp interface.

The code is as follows:

> exit

Thank you for your reading, the above is the content of "the method of using LFTP in Linux system". After the study of this article, I believe you have a deeper understanding of the problem of using LFTP in Linux system, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report