lftp
Introduction to lftp
lftp is a sophisticated command-line file transfer program that supports a variety of protocols, including FTP, SFTP, HTTP, and FTPS. It is designed for reliability and efficiency, offering features like automatic retries, parallel transfers, and mirroring capabilities. lftp is widely used for managing file transfers in both personal and professional environments.
With its scripting capabilities and robust error handling, lftp is an excellent choice for automating file transfer workflows. It also supports bookmarks, queueing, and background transfers, making it a versatile tool for advanced users. For more details, visit the official lftp documentation.
Using lftp with Modules
To use lftp on the terrabyte HPC system, load the lftp module with the following command:
# consider adding the module use line to your ~/.bashrc to always make terrabyte modules available
module use /dss/dsstbyfs01/pn56su/pn56su-dss-0020/usr/share/modules/files/
module load lftp
Usage Examples
Once loaded, you can start using lftp to transfer files. Below are some examples of common lftp operations:
Example 1: Connect to an FTP Server
To connect to an FTP server:
lftp ftp://ftp.example.com
Example 2: Download a File
To download a file from a remote server:
lftp -e "get remote_file.txt; bye" ftp://ftp.example.com
Example 3: Upload a File
To upload a file to a remote server:
lftp -e "put local_file.txt; bye" ftp://ftp.example.com
Example 4: Mirror a Directory
To mirror a remote directory to a local directory:
lftp -e "mirror /remote_directory /local_directory; bye" ftp://ftp.example.com
Example 5: Use SFTP for Secure Transfers
To connect to a server using SFTP:
lftp sftp://user@server.example.com
For additional usage instructions and configuration details, refer to the lftp documentation.