I originally wrote most of this article as a sort of “cheat sheet” while I was working in an IT shop at UCSB. I wanted to mirror it here as I no longer work in that shop and would be bummed to lose the article. You can find it here if you want.

If you’re not familiar with, LFTP it bills itself as a “sophisticated file transfer program”. It supports common protocols like FTP, HTTP/s, FXP, SFTP, and BitTorrent. It can also download multiple files in parallel, download one file as multiple segments in parallel, and resume a paused or canceled download.

If you’re on Linux, you should find LFTP in your distribution’s package repository. It’s also easily available on OS X via brew. If neither of those work for you, the LFTP site linked above contains source code and rpm binaries.

LFTP consists of a number of commands. LFTP will give you an interactive shell to call these commands, like an FTP or shell session. You can also pass commands directly to LFTP with no interactivity, more like rsync. Each of LFTP’s commands does different things and takes different options. Some can be strung together to do great things, but unless you use LFTP frequently you’ll never remember them. That’s why I wrote down these common example use cases so you can get going quickly:


  • Connect to an FTP server with authentication, get dropped into an LFTP shell:
      lftp -p21 username ftp://ftp.ucsb.edu
  • Connect to an SSH server, get dropped into an LFTP shell:
      lftp user@ucsb.edu


Once you’re connected to the remote server, you can start pulling down files:

  • Download a file with pget with continue support in 8 segments:
      lftp> pget -c -n 8 ./debian-6/debian-6.i386.iso

  • Mirror a directory using pget with continue support, 4 concurrent files and 8 concurrent segments per file:
      lftp> mirror -c -P 4 --use-pget-n=8 ./debian-6

  • Download multiple files with a glob expression, continue, pget, and 12 segments:
      lftp> glob -- pget -c -n 12 ./debian-6/*

  • Mirror multiple directories slected by a glob, using continue, pget for 12 segments, and mirror for 4 concurrent files:
      lftp> glob -d -- mirror -c -P 4 --use-pget-n=12 ./debian*

New Miscellaneous (June 2020)

  • Execute some LFTP commands and keep the shell open with -e flag:
      lftp -e "cd A; pget A.txt; cd ../B; pget B.txt" ftp://ftp.ucsb.edu
  • Execute an LFTP script file with -f flag:
      lftp -f ./script.lftp

    Our LFTP script downloads remote_dir to local_dir with mirror and pget:

      # script.lftp
      open sftp://
      mirror -c -P 2 --use-pget-n=4 ./remote_dir /mnt/local_dir