Informing the IBM Community



If you know all about the TCP/IP utility FTP, you will feel right at home with this nifty utility.

If you are fed up with all the virus’s in the open-source utility FileZilla, give lftp a try.  You will not be disappointed.

As the man page for lftp states; lftp is a file transfer program that allows sophisticated FTP, HTTP and other connections, to other hosts.

Additionally, the lftp command has a great feature called mirror.

The mirror feature can download or update a whole directory tree. There is also a reverse mirror (mirror -R) that uploads or updates a directory tree on the server/host.

The mirror can also synchronise directories between two remote servers.  All very useful.

Some of the features of lftp are;

  • Tab completion for remote file names
  • Bash-like ability to run transfers in the background
  • Support for multiple protocols, including ftp, sftp, HTTP and more
  • Transfer rate throttling
  • Ability to download/create a full mirror of a remote site with the ‘mirror’ feature


Installing lftp is as simple as running a yum command, as can be seen below.

yum install lftp

or using IBMs Access for Client Solutions (ACS) open-source package management.

Don’t forget, the package management option of ACS has now moved to the front, in this latest version!

As can be seen from the figure above, I have the lftp package installed at version 4.8.3

Using lftp

There is no configuration necessary for lftp, let us go ahead and start using it.

As I stated earlier, lftp can connect to hosts using many communication protocols.

For this article, I’ll be using the FTP protocol to show how easy it is to use.

Firstly, fire up a shell session on your IBM i, and use the syntax below to connect to your intended host.

lftp ftp.host_name

where the ftp. is the protocol to use. 

If you intend using FTP, you do not have to specify it, it will use ftp as the default.  That’s handy!

Once it has connected to the host, you have to enter your user name and password.

To elaborate the above figure, we have

  1. Lftp to another of our IBM i partition, Proteus
  2. Entering the user name and password for this host
  3. Show the remote directory contents, using the ls command

You could enter the user details directly on the command line, using the -u argument, such as;

lftp proteus -u andy,whoknows

Once we are in the lftp session, we then use all the normal ftp commands, put, get, etc.

To exit out of a lftp session, use the quit option.

lftp Mirror

We briefly mentioned the mirror option earlier, so let me give you an example of this great feature.

The syntax of the mirroring features is very simple, just use the following layout;

mirror source target

in the example below, I’m mirroring the ansible directory (guess what project I’m working on at the moment!) onto our other partition, where it does not exist.

  1. Within the lftp session, start the mirroring fuction
  2. Shows a status of transfer
  3. A ls shows the remote ansible directory now on the remote machine

I’m sure you agree, it is very similar to the rsync utility I wrote about previously.  If you need a refresher, take a look at the article here.

Be assured that lftp mirror command does not remove files by default, only if you add -e or –delete options.

If you only want lftp to check you have the syntax correct, and do not want it to copy any files, you can add the dry run option.

mirror –dry-run

If you only want the mirror feature to copy newer files or missing files, just add the parameters listed below.




Yes, I agree with what you are thinking “That’s not going to make a lot of difference!”  True, but it just goes to show what a great range of tools we now have in our open-source toolkit.

In my view, another great addition to the open source on IBM i catalogue.  Make use of this facility, you will benefit.

Check out the lftp website for full details of this product.

All the examples I have written for this article, and previous ones, can be found on my open-source repository on GitHub, which can be found at

If you have any questions, either on this article, or anything else on the IBM i, use the comments below, or send me a message on twitter @AndyYouens

Andy Youens is an IBM i consultant/instructor at Milton Keynes, UK-based FormaServe Systems with over 40 years IBM midrange experience. 

IBM Champion

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.


One response to “LFTP on IBM i”

  1. Sounds really useful Andy. I need to get into these facilities more.

Leave a Reply

Your email address will not be published. Required fields are marked *