Fact-checked by Grok 2 weeks ago

lftp

lftp is a sophisticated, command-line-driven program designed for operating systems, supporting multiple network protocols such as FTP, HTTP, , Fish, and with DHT for reliable and efficient data transfers. Developed by Alexander V. Lukyanov, lftp was first released in 1996 as an advanced alternative to traditional FTP clients, featuring shell-like command syntax, job control similar to , and integration with the readline library for enhanced user input. It emphasizes reliability through automatic retries, reget functionality, and the ability to handle parallel transfers, making it particularly useful for mirroring directories and managing large-scale file operations. As free software licensed under the GNU General Public License (GPL), lftp has evolved through numerous releases, with the latest stable version as of November 2024 being 4.9.3, issued on November 8, 2024. It has supported full IPv6 since version 2.0 in 1999 and includes optional dependencies like GnuTLS or OpenSSL for secure connections. Key features include built-in bookmarks for quick site access, a powerful mirror command for synchronized backups, and scripting capabilities that allow grouping commands for complex workflows. Widely adopted in Linux distributions and available on platforms like macOS and Windows via ports, lftp remains a preferred tool for system administrators and developers requiring robust, protocol-agnostic file management without graphical interfaces.

Description

Purpose and design

lftp is a sophisticated command-line file transfer program designed primarily for Unix-like operating systems, providing advanced capabilities for managing file transfers across networks. It serves as a versatile client supporting multiple protocols, including FTP, HTTP, and others, while offering a shell-like interface that enhances user interaction beyond basic file transfer tools. The core design philosophy of lftp emphasizes reliability, particularly in unstable or error-prone network environments, through features such as automatic retries for interrupted transfers, error recovery mechanisms that repeat operations on non-fatal errors, and support for resuming downloads even when the remote server lacks REST command compatibility. Built with job control similar to the Bash shell, lftp incorporates background processing to handle multiple tasks asynchronously, allowing users to queue and manage transfers efficiently without interrupting the session. This approach addresses limitations in traditional FTP clients by enabling robust, fault-tolerant operations suitable for large-scale or intermittent connections. Historically, lftp was developed as an enhancement to the standard ftp command, introducing a more intuitive shell-like syntax for executing parallel and sequential commands, which simplifies complex transfer workflows. For instance, users can group commands within parentheses for sequential execution, such as (get [file](/page/File)1; get [file](/page/File)2), or append an to run jobs in the background, like get [file](/page/File) &, facilitating greater control and in management tasks.

Platform support and licensing

lftp is primarily designed for and natively supported on Unix and operating systems, including various distributions such as , , and , as well as BSD variants like and . Ports to Windows are facilitated through Unix compatibility environments, notably , which provides a layer for running Unix tools, and MSYS2, a and building platform for Windows. The software is written in C++ and licensed under the GNU General Public License (GPL) version 3 or later, a license that promotes by requiring derivative works to be distributed under the same terms, ensuring users' freedoms to use, study, modify, and share the program. The transition to GPL v3 occurred in version 3.7.7 to accommodate dependencies like gnulib modules that mandate this version. Building lftp from source requires the GNU Readline library for enhanced interactive input, including command editing and history, and the zlib library for compression features. For support of secure protocols, optional dependencies include or development libraries to handle encryption and TLS/SSL connections. lftp is distributed through native package managers on systems, such as apt on Debian-based distributions (e.g., sudo apt install lftp on or ) and yum or dnf on Red Hat-based systems (e.g., sudo yum install lftp on or ). Users seeking the latest version or custom builds can compile it from official source tarballs released on the project's website.

Development history

Origins and initial releases

lftp was created by Alexander V. Lukyanov, a software developer based in , , during the mid-1990s. Lukyanov initiated the project to overcome the shortcomings of contemporary FTP clients, which struggled with the unreliable connections common in that era, often characterized by frequent dropouts and variable . From its inception, lftp's design prioritized robustness, incorporating queuing mechanisms for multiple transfers and automatic resumption capabilities to restart interrupted downloads seamlessly, even if the remote server did not support partial transfers. These features addressed the practical challenges of file transfers over unstable networks, allowing users to continue operations without manual intervention after errors. The first public release, version 0.1, arrived in August 1996, concentrating on foundational FTP improvements such as enhanced error handling and basic connectivity retries. Early versions quickly evolved, with distributions like including lftp 0.10.0 in 1997. lftp was initially distributed via mailing lists and incorporated into early distributions, fostering adoption within and open-source communities. By 1998, the release of version 0.14.0 highlighted its growing popularity, as announced on platforms like Weekly News, where it was praised for its shell-like interface and reliability features.

Evolution and maintenance

Following its initial releases, lftp underwent significant expansions in protocol support during the early . Version , released in June 1999, introduced HTTP support alongside improvements to reporting and overall protocol handling. In the 2.6 series, launched in late 2003, and protocols were added, providing secure options over SSH and enabling lftp to serve as a versatile alternative to dedicated clients. The 3.0 release on April 2, 2004, brought further refinements, while support was integrated in version 3.7.16 in August 2009, allowing the tool to function as a basic client with DHT capabilities added in later updates. In the 2010s, the project's repository migrated to under maintainer Alexander V. Lukyanov (username lavv17), promoting easier collaboration, issue tracking, and pull requests for ongoing development. The most recent stable release, version 4.9.3 on November 8, 2024, addressed several issues including out-of-order packet handling, tracker looping in mode, core dumps, and compilation problems across environments, alongside implicit performance gains from these fixes; support for TLS 1.3 was refined in the 4.9.x series through underlying library integrations like and . Maintainer activity has been constrained since 2020, evidenced by the four-year gap between 4.9.2 (August 2020) and 4.9.3, during which only minor patches were applied. Community involvement remains active via the official mailing list at [email protected], where users report bugs, propose fixes, and discuss enhancements; the 4.9.x series has emphasized security patches, such as vulnerability resolutions in 4.8.4, and compatibility updates for modern systems and protocols.

Features

Supported protocols

lftp supports a range of network protocols for file transfers, enabling connections to remote servers via standard and secure methods. The core protocol is FTP (File Transfer Protocol), which facilitates basic anonymous and public file transfers in both active and passive modes, adhering to standards such as RFC 959, RFC 2389, RFC 3659, and extensions for deflate compression. Secure variants enhance data protection during transfers. FTPS (FTP over SSL/TLS) provides encrypted FTP sessions using RFC 4217, requiring either GnuTLS or OpenSSL libraries for implementation. HTTPS (HTTP over SSL/TLS) secures web-based transfers with encryption and authentication support per RFC 2616 and RFC 2617. SFTP (SSH File Transfer Protocol) operates over SSH version 2 as a subsystem, following draft-ietf-secsh-filexfer-13, for authenticated and encrypted file operations. Additional protocols extend lftp's capabilities beyond traditional client-server models. HTTP (Hypertext Transfer Protocol) allows retrieval of files from web servers using GET and POST methods, compliant with RFC 1945 and RFC 2616, with partial support for . FISH (Files over ) enables file access over SSH connections to accounts, mimicking scp-like operations without a dedicated server. BitTorrent supports torrent downloads and seeding via the 'torrent' command, implementing specifications such as BEP 0003, BEP 0005 (DHT), and BEP 0006. HFTP (HTTP File Transfer Protocol) permits FTP access through an HTTP proxy when configured, such as via the ftp:proxy setting pointed to an HTTP endpoint. lftp employs automatic protocol detection through URL schemes, such as ftp:// for FTP, ftps:// for , http:// for HTTP, https:// for , sftp:// for , and fish:// for , simplifying connection setup in commands like 'open'. Proxy support is available for HTTP and FTP protocols, configurable via environment variables or lftp settings like http:proxy and ftp:proxy.

Core functionalities

lftp provides advanced tools for efficient file transfers and directory management, leveraging multiple connections and automation to enhance reliability and speed across supported protocols. Its core functionalities emphasize segmented downloading, where the pget command splits files into segments fetched via parallel connections, accelerating transfers by utilizing available bandwidth more effectively. Resuming partial transfers is supported through commands like reget and get -c, allowing interrupted downloads or uploads to continue from the point of failure without restarting. Additionally, bandwidth throttling via the net:limit-rate setting enables users to cap transfer speeds per connection, host, or globally, preventing network overload. For directory operations, lftp includes recursive mirroring with the mirror command, which synchronizes entire directory trees between local and remote locations, including options for reverse mirroring (-R) to upload changes and FXP (direct server-to-server transfers) for FTP-to-FTP operations. Transfer queues facilitate batch processing by queuing multiple commands for sequential or timed execution per site, supporting operations like --delete to remove processed items. The delete-after functionality, available via -E in get or --Remove-source-files in mirror, automatically removes source files post-transfer to streamline synchronization tasks. Utility features enhance usability with bookmarks, stored in ~/.lftp/bookmarks, for saving and quickly accessing frequent server sessions. Paging of remote files is possible by output to external viewers like zmore, allowing inspection without full downloads. Command history persists in a file, enabling recall and reuse of previous inputs for efficient session management. Error handling is robust, with automatic retries on failures configurable via net:max-retries, defaulting to unlimited attempts on retriable errors or timeouts to ensure completion. Progress displays during transfers show rates, estimated times, and status updates, toggled by cmd:show-status for monitoring long-running operations.

Usage

Interactive mode

lftp operates in interactive mode by default when invoked from the command line without the -c or -f options, providing a shell-like for real-time operations. To start an interactive session, users execute the command lftp [options] [site], where [options] can include settings like -u username,password for or -p [port](/page/Port) for specifying a non-standard , and [site] is the target URL such as ftp://[example.com](/page/Example.com). If no is provided, lftp launches directly into the interactive , denoted by lftp :~>, allowing subsequent connections and commands to be entered manually. Once in interactive mode, establishing a uses the open command, formatted as open [options] site, for example, open ftp://[user](/page/User)@host. This command supports various protocols and handles through options like -u [user](/page/User)[,pass] to specify credentials, or by falling back to the ~/.netrc file for stored details if none are provided in the . configurations are managed via settings such as set ftp:[proxy](/page/Proxy) http://proxyhost:[port](/page/Port), enabling connections through intermediaries for restricted networks. After a successful , the prompt updates to reflect the remote site, such as lftp [user](/page/User)@host:/[path](/page/Path)>. Basic navigation within the remote filesystem employs familiar commands analogous to shell utilities: ls lists directory contents (with caching for efficiency), cd rdir changes the current remote directory (e.g., cd /documents), and pwd displays the present working directory as a full URL. For file operations, get rfile [-o lfile] retrieves a remote file to the local system (optionally renaming it locally), while put lfile [-o rfile] uploads a local file to the remote server (with optional remote renaming). These commands support progress indicators and can be interrupted with Ctrl+C for resuming later if segmentation is enabled, though basic usage focuses on straightforward transfers. Session management in interactive mode includes commands to synchronize directories or exit cleanly: mirror [options] [source [target]] performs a basic recursive copy from remote to local (or vice versa with --reverse), with --verbose enabling detailed output on files processed. To end the session, bye or quit disconnects from the host and returns to the shell, preserving any queued jobs if applicable. For users new to lftp, installation is typically handled via package managers, such as apt install lftp on Debian-based systems. Advanced scripting builds on this interactive foundation but is covered separately.

Scripting and batch operations

lftp supports non-interactive scripting and batch operations through command-line flags and built-in mechanisms, enabling of file transfers without user intervention. The -c flag allows execution of a single command string, such as lftp -c "open ftp://user:pass@host; mirror /remote/dir /local/dir", which connects to the specified site and mirrors the directory contents. Similarly, the -f flag reads and executes commands from a script , for instance lftp -f script.lftp where the file contains lines like open ftp://host followed by transfer commands. These options facilitate unattended operations, contrasting with interactive sessions by processing predefined sequences and exiting upon completion. For automation, lftp integrates seamlessly with scheduling tools like cron for periodic tasks. A common example is a cron job configured as */5 * * * * lftp -c "open sftp://user@host; mirror -c /remote /local", which synchronizes directories every five minutes, ensuring up-to-date backups or deployments. Shell scripts can handle dynamic sites by generating a list of files and using it for selective transfers, such as remotefiles="file1 file2"; lftp -c "open host; mget $remotefiles". Environment variables enhance configurability; for example, setting LFTP_HOME=/custom/path directs lftp to use a specific directory for configuration files, allowing tailored setups for different automation scenarios without altering global defaults. Advanced leverages lftp's for parallel or sequential transfers within scripts. Commands like queue get file1; queue get file2; queue start enqueue multiple downloads, executing them concurrently up to a configurable (default 5), which optimizes usage in automated workflows. handling and are enabled via settings such as set log:enabled true and set log:file /path/to/log, capturing transfer details to files like ~/.lftp/transfer_log for post-run analysis and in batch environments. Integration with other tools extends lftp's utility in hybrid setups; for instance, scripts can conditionally invoke lftp based on checks before using for local synchronization, creating robust pipelines like if [ -d /local/target ]; then lftp -c "open ftp://user@host; mirror /remote /local/ftp"; [rsync](/page/Rsync) -av /local/ftp/ /local/target/; fi. This approach combines lftp's protocol flexibility with 's efficiency for comprehensive tasks.

References

  1. [1]
    LFTP - sophisticated file transfer program
    LFTP is a sophisticated file transfer program supporting a number of network protocols (ftp, http, sftp, fish, torrent). Like BASH, it has job control and ...
  2. [2]
    lavv17/lftp: sophisticated command line file transfer ... - GitHub
    Command line driven, shell-like, reliable file transfer program. It supports a number of protocols and even BitTorrent with DHT! IPv6 is fully supported too.
  3. [3]
    a/lftp - LWN.net
    From: "Alexander V. Lukyanov" <lav@yars.free.net> Subject: lftp-0.14.0 - command line driven ftp client Date: Fri, 30 Jan 1998 11:50:08 GMT -----BEGIN PGP ...
  4. [4]
    lftp man - Linux Command Library
    lftp was developed by Alexander Lukyanov and first released around 1999. It was conceived as a powerful and feature-rich alternative to the traditional `ftp` ...
  5. [5]
    the manual page - LFTP
    lftp is a file transfer program that allows sophisticated FTP, HTTP and other connections to other hosts.
  6. [6]
    FreshPorts -- ftp/lftp: Shell-like command-line FTP client
    LFTP is a shell-like command line ftp client. It is reliable: can retry operations and does reget automatically. It can do several transfers simultaneously ...<|control11|><|separator|>
  7. [7]
    Releases · lavv17/lftp - GitHub
    Nov 8, 2024 · Releases: lavv17/lftp ; Release 4.9.2. Nov 8, 2024 · v4.9.2 · 586b256 · 2 ; Version 4.9.1. Jan 15, 2020 · v4.9.1 · f13bcff · 2 ; Version 4.9.0. Jan 15, ...
  8. [8]
    How to use the LFTP client to download files - TechTarget
    Mar 14, 2024 · LFTP is an open source file transfer program that supports multiple protocols. Learn how to use the LFTP client on Linux, macOS and Windows.
  9. [9]
    lftp - openSUSE Software
    LFTP is a reliable shell-like command line FTP client. It can retry operations and does reget automatically. It can do several transfers simultaneously in the ...<|control11|><|separator|>
  10. [10]
    lftp - Linux in a Nutshell, 6th Edition [Book] - O'Reilly
    The lftp command allows FTP and HTTP protocol transfers, plus other protocols including FISH (SSH based), FTPS, and HTTPS. It uses a shell-like command ...
  11. [11]
    net/lftp - The NetBSD Packages Collection
    lftp has reliable put, reput, mirror, and many other commands. lftp supports ftp, http, https, fish and sftp protocols. Source version: lftp-4.9.3nb1 ...
  12. [12]
    Cygwin Package Summary for lftp
    lftp is a sophisticated file transfer program and ftp/http/bittorrent client. It supports multiple network protocols. It offers tab completion, command history, ...Missing: msys2 | Show results with:msys2
  13. [13]
    lftp - MSYS2 Packages
    lftp is a sophisticated command line based FTP client. Install it with `pacman -S lftp`.Missing: windows | Show results with:windows
  14. [14]
    news - LFTP
    Version 3.5.1 - 2006-07-05 ... When it is false, lftp waits for more disk space instead of cancelling transfers in case of full disk (Glenn Maynard, Alexander ...
  15. [15]
    lftp 4.9.3-1 (x86_64) - Arch Linux
    Sophisticated command line based FTP client. Upstream URL: https://lftp.yar.ru/. License(s):, GPL-3.0-or-later. Maintainers: Andreas Radke. Package Size: 772.7 ...
  16. [16]
    RemoteFiles - Debian Wiki
    Dec 6, 2021 · Installing LFTP. The LFTP package in Debian is called lftp and is installed with apt-get update apt-get install lftp. Howto on editing remote ...
  17. [17]
    lftp - Fedora Packages
    LFTP is a sophisticated ftp/http file transfer program. Like bash, it has job control and uses the readline library for input. It has bookmarks, built-in ...
  18. [18]
    Description - LFTP
    LFTP is a sophisticated file transfer program with command line interface. It supports FTP, HTTP, FISH, SFTP, HTTPS and FTPS protocols.Missing: origins V. 1996
  19. [19]
    http://ftp.kh.edu.tw/Linux/Debian/debian-archive/d...
    ... lftp Version: 0.10.0-1 Priority: optional Section: net Maintainer: Christoph ... (August 1996) of the Linux Gazette, an online magazine covering Linux ...
  20. [20]
    Index - Ibiblio
    ... 0.1 /public/usenet/comp.os.linux.announce/volume93/Mar/930303.01 Sunsite ... 1996 /public/usenet/comp.os.linux.announce/volume95/Nov/951123.03.gz ...
  21. [21]
    Mark Blackburn - [ANNOUNCEMENT] Updated: lftp-2.6.8-3
    Nov 13, 2003 · Using lftp with the fish protocol makes it a convenient substitute for sftp. Here's a list of changes since 2.6.6 (from the lftp homepage): ...
  22. [22]
    events - LFTP
    2019-12-21: lftp-4.9.0 released. 2018-08-01: lftp-4.8.4 released. Some bugs fixed, including a security vulnerability. 2017-10 ...
  23. [23]
    Mailing lists - LFTP
    LFTP has got two quite quiet mailing lists, managed by GNU Mailman: lftp@uniyar.ac.ru for general discussions and major version announcements and lftp-devel@ ...
  24. [24]
    LFTP features
    Bookmarks. Aliases. Saving of last directory on each site. `cd -' to go there. Copying of files (including mirror) between two servers over the client ...Missing: documentation downloading
  25. [25]
    Linux / Unix lftp Command To Mirror Files and Directories - nixCraft
    Apr 13, 2022 · Explains how to mirror files and directories (get and put method) using FTPS/HTTPS protocol using lftp command under Linux, macOS & Unix.<|separator|>
  26. [26]
    Automating LFTP Using Bash Scripts | Baeldung on Linux
    Feb 28, 2025 · In this article, we've shown several methods for automating lftp file transfers using bash scripts on Linux, from basic to more advanced scenarios.Missing: operations | Show results with:operations<|control11|><|separator|>