How to Speed Up Downloads with lftp Segmented Download

This guide explains how to use lftp to download files faster by using segmented downloads, parallel transfers and directory synchronization.

Segmented download allows one file to be downloaded using multiple connections at the same time. This can improve download speed, especially for large files or long-distance transfers.

⚠ Important

Do not use too many connections. In most cases, 4–8 segments are enough. We recommend not using more than 10–20 connections, as too many connections may reduce performance or cause connection issues.

💡 Tip

Your service hostname, SSH/FTP username and SSH/FTP password can be found in the Client Area under your service details.


Install lftp

Ubuntu or Debian

Install lftp with:

sudo apt update
sudo apt install lftp

CentOS, AlmaLinux or Rocky Linux

Install lftp with:

sudo dnf install lftp

macOS

On macOS, you can install lftp with Homebrew:

brew install lftp

Windows

lftp is not available in Windows PowerShell or Command Prompt by default.

To use lftp on Windows, install Windows Subsystem for Linux (WSL) and then install lftp inside your Linux environment.

After installing WSL with Ubuntu, open Ubuntu from the Start Menu and run:

sudo apt update
sudo apt install lftp
⚠ Windows Users

On Windows, lftp should be used from WSL or another Linux-like environment. It is not a native Windows PowerShell command.


Connect to Your Service

You can connect using either FTP/FTPS or SFTP.

FTP or FTPS

To connect using FTP or FTPS, run:

lftp -u username,password ftp://server.hostname.com

Replace:

  • username with your SSH/FTP username.
  • password with your SSH/FTP password.
  • server.hostname.com with your service hostname.

SFTP

To connect using SFTP, run:

lftp sftp://username@server.hostname.com

Replace:

  • username with your SSH/FTP username.
  • server.hostname.com with your service hostname.

You will be asked for your SSH/FTP password after connecting.


Download a Single File with Multiple Segments

After connecting to your service, use pget to download a single file using multiple segments.

Example with 8 segments:

pget -n 8 filename.mkv

Replace filename.mkv with the file you want to download.

💡 Tip

Use pget -n for one large file. This is the command that downloads a single file in multiple segments.


Resume an Interrupted File Download

If a single file download was interrupted, you can resume it with:

pget -c -n 8 filename.mkv

The -c option continues the existing partial download instead of starting from the beginning.


Download a Directory

To download a whole directory, use mirror.

Example:

mirror --continue --parallel=8 remote_folder local_folder

Replace:

  • remote_folder with the directory on your service.
  • local_folder with the local directory where files should be downloaded.

Example:

mirror --continue --parallel=8 downloads downloads

This will download the remote downloads directory to a local directory named downloads.

💡 Tip

For directories, mirror --parallel downloads multiple files at the same time. For one large file, use pget -n to download it using multiple segments.


Upload a Directory

You can also upload a local directory to your service using reverse mirror mode.

Example:

mirror -R --continue --parallel=8 local_folder remote_folder

Replace:

  • local_folder with the directory on your local computer.
  • remote_folder with the destination directory on your service.

Example:

mirror -R --continue --parallel=8 uploads uploads

This will upload the local uploads directory to a remote directory named uploads.


Sync Directories

You can use mirror to synchronize directories between your local computer and your service.

Sync from Remote to Local

To download new and changed files from your service to your local computer, run:

mirror --continue --parallel=8 remote_folder local_folder

This copies missing or changed files from remote_folder to local_folder.

Sync from Local to Remote

To upload new and changed files from your local computer to your service, run:

mirror -R --continue --parallel=8 local_folder remote_folder

This copies missing or changed files from local_folder to remote_folder.


Sync Your Downloads Directory

If you want to synchronize your whole downloads directory from time to time, run mirror on the full remote directory where your files are stored.

Example remote to local sync:

mirror --continue --parallel=8 downloads downloads

This will download new and changed files from the remote downloads directory to a local directory named downloads.

If your files are stored in another directory, replace downloads with the correct path.

Example with an absolute remote path:

mirror --continue --parallel=8 /home/username/downloads /local/downloads
💡 Tip

You can run the same command again later. lftp will skip files that are already downloaded and continue downloading missing or changed files.


Exact Sync with Delete

If you want the destination directory to match the source directory exactly, you can add the --delete option.

Remote to local exact sync:

mirror --continue --delete --parallel=8 remote_folder local_folder

Local to remote exact sync:

mirror -R --continue --delete --parallel=8 local_folder remote_folder
⚠ Important

Be careful with the --delete option. It removes files from the destination directory if they do not exist in the source directory. Use it only when you are sure the source directory is correct.


Show Transfer Progress

lftp shows transfer progress during active downloads. For directory transfers, you can enable more detailed progress output by adding the --verbose option.

Example directory sync with progress:

mirror --continue --verbose --parallel=8 downloads downloads

Example single file download with progress:

pget -c -n 8 filename.mkv

You will see the current transfer progress directly in the terminal.


Keep Transfers Running After Closing SSH

If you are running lftp on a remote server or inside an SSH session, use screen to keep the transfer running even after disconnecting from SSH.

Step 1 – Install screen

On Ubuntu or Debian, install screen with:

sudo apt install screen

Step 2 – Start a screen Session

Create a new screen session:

screen -S lftp-transfer

Step 3 – Start lftp

Connect with lftp and start your download or sync command.

Example:

lftp -u username,password ftp://server.hostname.com

Then run:

mirror --continue --verbose --parallel=8 downloads downloads

Step 4 – Detach from screen

To leave the transfer running in the background, press:

CTRL+A then D

You can now close your SSH session or terminal. The transfer will continue running inside screen.


Step 5 – Return to the Running Transfer

To reconnect to the running transfer later, log back in via SSH and run:

screen -r lftp-transfer

You will return to the same lftp session and see the transfer progress.

⚠ Important

Do not start many separate screen sessions with large lftp transfers at the same time. This may generate too many connections and reduce performance.


Useful lftp Commands

After connecting with lftp, you can use the following commands:

  • ls – list files in the current remote directory.
  • cd folder – change the remote directory.
  • lcd folder – change the local directory.
  • pwd – show the current remote directory.
  • lpwd – show the current local directory.
  • pget -n 8 file – download one file using 8 segments.
  • pget -c -n 8 file – resume an interrupted segmented file download.
  • mirror --continue --parallel=8 remote local – download or update a local directory from a remote directory.
  • mirror -R --continue --parallel=8 local remote – upload or update a remote directory from a local directory.
  • mirror --continue --verbose --parallel=8 remote local – sync a directory with progress output.
  • mirror --continue --delete --parallel=8 remote local – make the local directory match the remote directory exactly.
  • mirror -R --continue --delete --parallel=8 local remote – make the remote directory match the local directory exactly.
  • exit – close lftp.

Useful screen Commands

Use these commands when you want to keep long transfers running in the background.

  • screen -S lftp-transfer – start a new screen session named lftp-transfer.
  • CTRL+A then D – detach from screen and keep the transfer running.
  • screen -r lftp-transfer – return to the running transfer session.
  • screen -ls – list running screen sessions.

One-Line Download Examples

You can also download a file or directory without opening an interactive lftp session.

Download One File with FTP

lftp -u username,password ftp://server.hostname.com -e "pget -c -n 8 /path/to/file.mkv; exit"

Download One File with SFTP

lftp sftp://username@server.hostname.com -e "pget -c -n 8 /path/to/file.mkv; exit"

Download a Directory with FTP

lftp -u username,password ftp://server.hostname.com -e "mirror --continue --verbose --parallel=8 /remote/folder /local/folder; exit"

Download a Directory with SFTP

lftp sftp://username@server.hostname.com -e "mirror --continue --verbose --parallel=8 /remote/folder /local/folder; exit"

One-Line Sync Examples

You can also synchronize directories directly from one command.

Sync Remote to Local with FTP

lftp -u username,password ftp://server.hostname.com -e "mirror --continue --verbose --parallel=8 /remote/folder /local/folder; exit"

Sync Local to Remote with FTP

lftp -u username,password ftp://server.hostname.com -e "mirror -R --continue --verbose --parallel=8 /local/folder /remote/folder; exit"

Sync Remote to Local with SFTP

lftp sftp://username@server.hostname.com -e "mirror --continue --verbose --parallel=8 /remote/folder /local/folder; exit"

Sync Local to Remote with SFTP

lftp sftp://username@server.hostname.com -e "mirror -R --continue --verbose --parallel=8 /local/folder /remote/folder; exit"

Troubleshooting

Download Is Not Faster

If the download is not faster, try a different number of segments:

pget -n 4 filename.mkv
pget -n 8 filename.mkv
pget -n 10 filename.mkv

Using more segments does not always mean better speed. The best value depends on your local connection, routing and server load.


Too Many Connections

If you use too many segments or parallel transfers, the connection may become unstable or slower.

⚠ Important

Avoid generating excessive connections. We recommend staying between 4 and 8 connections for normal use and not exceeding 10–20 connections.


Wrong Path or File Not Found

If lftp cannot find the file or directory, check the current remote directory:

pwd

List files with:

ls

You can also use an absolute path, for example:

pget -n 8 /home/username/downloads/file.mkv
mirror --continue --parallel=8 /home/username/downloads downloads

Transfer Is Still Running

If you started the transfer inside screen, it may still be running in the background.

List active screen sessions:

screen -ls

Reconnect to your transfer session:

screen -r lftp-transfer

Verification

✔ Transfer Started

If the file transfer starts and shows multiple segments, pget is downloading the file using segmented download. If a directory transfer starts multiple files at the same time, mirror --parallel is working correctly.

⚠ Important

Please use segmented downloads and parallel transfers responsibly. Too many simultaneous connections can reduce performance and may affect other users on shared services.

Was this answer helpful? 0 Users Found This Useful (0 Votes)