When it comes to the availability of ftp (file transfer protocol) client solutions, the Linux operating system, and its numerous distributions never disappoint.
In this area, there is plenty of fish in the ocean. The Linux-based ftp clients are a mixture of GUI and non-GUI solutions. Ftp client solutions not only give you access to remote machines and servers but also enable you to easily upload/download files to/from your remote machines/servers.
[ You might also like: How to Download and Upload Remote Directory in sFTP ]
For these file transfers (uploads and downloads) to take place successfully, an FTP client has to support various data transfer protocols. The feature-rich nature of LFTP enables it to support numerous network management, network communication, and network security protocols such as FTP, sFTP, FTPS, FISH, HFTP, SSH, HTTP, HTTPS, and BitTorrent.
Another important LFTP-supported protocol is FXP (File eXchange Protocol). Through it, two remote FTP servers can comfortably exchange directory files.
Prime LFTP Features
With LFTP, you can schedule when to initiate/execute a file transfer operation. This approach is seamlessly implemented through automated scripts for users seeking an alternative from the LFTP interactive mode where file transfer operations are handled manually.
Other notable LFPT features include:
- Transfer queues
- Resuming partial downloads
- Segmented file transfer
- Bandwidth throttling
- File directories recursive copying
- Bookmarks support
How to Install LFTP in Linux
To use the LFTP client on the Linux operating system distribution of your choice, go with one of the following LFTP installation commands.
$ sudo apt-get install lftp [On Debian, Ubuntu and Mint] $ sudo yum install lftp [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux] $ sudo emerge -a net-ftp/lftp [On Gentoo Linux] $ sudo pacman -S lftp [On Arch Linux] $ sudo zypper install lftp [On OpenSUSE]
LFTP Passwordless Access in Linux
Since LFTP supports SSH protocol, we could generate an SSH key so that we do not have to connect to our server via password authentication.
$ sudo ssh-keygen -t rsa
Skip Enter passphrase: step by pressing [Enter] on the keyboard.
Next, copy generated SSH key to remote Linux server.
$ sudo ssh-copy-id [email protected]
Test SSH passwordless access.
$ sudo ssh [email protected]
LFTP Usage and Examples in Linux
To use the LFTP client, you need to adhere to its standard syntax rule. You need to be familiar with the username and hostname/IP address of the remote machine you wish to connect to via LFTP. You might optionally need to specify the port number through which LFTP will connect to the remote machine/server.
$ lftp sftp://your_username@your_hostname/host_IP_address OR $ lftp sftp://your_username@your_hostname/host_IP_adress:port_number
An example connection to a remote server via lftp can be implemented in the following manner:
$ sudo lftp sftp://[email protected]
Since we configured an SSH key, just press [Enter] on your keyboard when prompted for a password.
We can use the ls command to view the directories and files on the remote server.
$ ls
Upload Files via LFTP
The command syntax for uploading data files under LFTP is as follows:
put name_of_file_to_send
Its example implementation will look as follows:
You first need to identify the file you need to send from the pwd (parent working directory) of your local machine.
> lpwd > put print.pdf
Download Files via LFTP
The command syntax for downloading data files to your local machine under LFTP is as follows:
$ pget name_of_file_to_download
Its example implementation will look as follows:
> pget linuxshelltips_v2.txt
Now that you have managed to successfully install and use LFTP for file upload and download, its man page offers a more dynamic approach to using this awesome ftp client.
$ man lftp