The lftp program can handle both multiple network protocols and simultaneous connections.
Protocol support:
Lftp supports the following protocols:
- ftp
- sftp
- http and https
- bittorrent
Further information on ftps etc here.
Parallel downloads:
To download a single large file located at <URI>
using 2 simultaneous connections:
lftp -c "pget -c -n 2 <URI>"
The first -c
option specifies the command(s) to run. pget
establishes a file transfer using several parallel connections. The second -c
option means continue transfer if this transfer had previously been interrupted. The -n
option limits the maximum number of connections to use.
There is more information on commands and options in the online man page.
Warning: This can speedup transfers, but loads the network and servers heavily. Speedups are contingent on network and server conditions.
To address the practical example in the question:
lftp -c "pget -c -n 2 sftp://[email protected]/~/backups/large.tar.gz"
This example downloads a large backup file over ssh (sftp) with 2 simultaneous connections. It assumes you have password-less ssh login setup.
Note: Lftp can also be used in an interactive mode; similar to other ftp commands.