How to Install lftp – A Simple Command line FTP Program

Last updated: August 21, 2022

This guide is about Lftp and how we can install Lftp in our Linux Operating System. Lftp is a command-line based File Transfer Software also known as FTP Client which was developed by Alexander Lukyanov and was distributed as GNU General Public License. Besides FTP, it also supports FTPS, HTTP, HTTPS, HFTP, FISH, and SFTP. The program also supports FXP, allowing for data transfers between two FTP servers bypassing the client machine.

It has some awesome advanced features such as recursively mirroring entire directory trees and resuming downloads. Transfers can be scheduled for execution at a later time, bandwidth can be throttled, transfer queues can be created, and Unix shell-like job control is supported. The client can also be used interactively or automated with scripts.

Installing Lftp

Before we try to run lftp, we have make sure that it is properly installed in our Linux Distribution. Here are some commands mentioned for installing lftp in the list of common distributions of Linux.

On Ubuntu

In Ubuntu and its derivatives, we can install lftp using apt manager. So, to install it, we'll need to run the following commands in a shell or a terminal under sudo privilege.

sudo apt install lftp
install lftp - on Ubuntu

On RHEL/CentOS Stream

As lftp is also available in the repository of Fedora, CentOS and RHEL, we can use yum manager to install it.

sudo yum install lftp
install lftp - on CentOS Stream

On Arch Linux

It is also available in Arch Linux Package Repository so, we can simply use pacman to install it.

sudo pacman -S lftp
install lftp - arch linux

On OpenSuse

Zypper, package management software for OpenSUSE can be used to install lftp. Here is the command with which one can install it on an OpenSuSE machine.

sudo zypper install lftp
install lftp - on OpenSUSE

Config Files

LFTP main configutaion file is located at /etc/lftp.conf and user specific config can set in either the ~/.lftprc or ~/.lftp/rc file.

Based on SSL and auth configuration you can have the following settings to true/false or yes/no.

set ftp:ssl-protect-data true
set ftp:ssl-force true
set ftp:ssl-auth TLS
set ssl:verify-certificate false
set ftp:use-feat false
set ftp:ssl-allow yes
set ftp:ssl-protect-list yes
set ftp:ssl-protect-fxp yes

Logging in

To login to an ftp server or sftp server, we'll first need to know about the required credential for the login like username, password, ports.

After that, we'll want to login using lftp client as basic usage.

lftp sftp://[email protected]

In case you get "ls: Fatal error: Host key verification failed." error, run the following command to fix the missing RSA key fingerprint in the list of known hosts.

ssh -p 22 [email protected]

If we need to point a port to the login then, we'll need to add port as shown below.

lftp sftp://[email protected]:22

Alternatively, you can connect using -p option

lftp -p 22 [email protected]domainname-or-ip-address


We can use ls to list files and directories, cd to enter into a directory.

Uploading and Download Files

We can use pget for downloading files from the remote server.

> pget linspeed.svg

We can use put for uploading files to the remote server.

> put singlefile.tar


lftp -e "put -O uploads /home/temp/file4; bye" sftp://[email protected]

Where uploads is the destination directory and /home/temp/file4 is the local file.

To resume partially downloaded files/directories, we will use the -c switch:

> mirror -c Directory

>pget -c linoxide.tar

> put -c upload.tar

Using Mirror

We can use 'mirror' to download the whole directory pointed as the source.

> mirror remote local

There is also a reverse mirror (mirror -R) which uploads or updates a directory tree on server.

> mirror -R local remote

To resume partially downloaded files/directories, we will use the -c switch:

> mirror -c Directory

To Queue Items to Download

We can use the queue option with lftp so that we can download selected files in a queue one by one. This is the same as in GUI-based clients to select and download in a queue. Here's an example on it.

To prevent queue from auto transferring while you add to it :

> queue stop

Now, we'll add them into queue.

> queue mirror "directory"

> queue pget "file.tar"

After the queue has been added, we should run queue start  command.

> queue start

To remove the entire queue run the following command.

> queue -d

Segmented Downloading

Here, in this example we are segmenting files into 3 segments, one can change it according to their own need.

A pget command using segmentation is pget -n 3 file.tar, where 3 is the number of segments.

> pget -n 3 file.tar

A mirror command using segmentation is mirror --use-pget-n=3 directory, where 3 is the number of segments.

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

We can use jobs -v to see the speeds of the individual segments as well as the total speed.

To Stop, Resume or Kill a Transfer

To cancel a transfer we can press Ctrl+c . And to resume a download we can use the -c (--continue) switch as shown below.

> mirror -c directory

And to kill an active transfer we should run kill and to kill and delete all we'll need to run kill all as shown:

> kill

> kill all


To quit from lftp, we should run exit command in the terminal or inside lftp interface.

> exit


We have successfully installed lftp and learned some basic ways to use it. lftp is an awesome command line ftp client which supports a lot of additional functionality and cool features. It has a lot of stuff more than the other common ftp client. You can explore more lftp commands to perform the file transfer.

If you have any questions, suggestions, or feedback please write them in the comment box below. Thank you!

About The Author

Bobbin Zachariah

Bobbin Zachariah

Bobbin started his career in IT in the year 2000 as a computer science instructor and worked as a Linux system engineer and senior analyst roles. Currently working in DevOps environments to increase efficiency and improve delivery time in AWS Cloud infrastructure. He is certified in RHEL, CCNA, and MCP and holds a Masters's in computer science. When in his free time love playing cricket, blogging, and listening to music.



Please add comments below to provide the author your ideas, appreciation and feedback.

Leave a Reply

Leave a Comment