lftp – advanced s/ftp/s client.

If you are dealing with ftp, ftps or sftp file transfer very likely you already have some favorite client for that purpose. I usually use FileZilla which works fantastic in graphical interface regardless it is on Linux/FreeBSD/MacOS or even Windows. For cli my first choice is lftp[1] whenever it is possible. It is maybe not easy to start with this program but it is really powerful. I highly recommend to spend a few moments to familiarize yourself with this product. It will pay off in the future, especially at the moment you will need to resume downloading 100GB file from ftps server like me recently 🙂

lftp is available under GNU license:

You can use lftp both, using interactive command or via script.

To start, assuming it is already installed just type lftp

If you are familiar with regular ftp server, you will be surprised with lots of lftp options:

With lftp command prompt you can set ftp option and then connect to the server with command connect.

If you need more detailed information, lftp can be run with option -d

Example (for ftps server):

lftp -d

The same options can be set in file ~/.lftprc.

For script processing program use option -f (lftp -f scriptfile)

The simplest scriptfile can have the following content:

open SERVER
user USERNAME PASSWORD
ls

or

open SERVER
user USERNAME PASSWORD
mirror --verbose -c --use-pget-n=3 DIRECTORYTODOWNLOAD .;

Of course, lftp provide much more functionality, including file download resume (-c).

Documentation:

[1] https://lftp.yar.ru/lftp-man.pdf
[2] https://unix.stackexchange.com/questions/592624/how-to-connect-to-server-with-tls-using-lftp
[3] https://www.librebyte.net/en/ftp-en/lftp-fatal-error-certificate-verification-not-trusted/
[4] https://superuser.com/questions/623236/simple-command-to-connect-to-ftps-server-on-linux-command-line
[5] https://danielhoherd.com/tech-notes/jdupes/
[6] https://serverok.in/download-all-files-from-ftp-server-using-lftp
[7] https://x8t4.com/12-lftp-commands-for-managing-files-with-examples/
[8] https://lftp.yar.ru/lftp-man.pdf
[9] https://www.reddit.com/r/linux/comments/4anfej/lftp_segmented_downloads_made_simple/
[10] https://ourcodeworld.com/articles/read/788/how-to-download-a-remote-directory-with-lftp-sftp-using-a-lftp-script

No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Linux
Creating random (not empty, thin provisioned) files in Linux

Recently I have found the command that can generate random file in linux environment where non empty (thin provisioned) files are required for testing: todo: combine that command with parallel command (or parallel that in python).

Linux
Nginx configuration for joplin note taking app

Introduction Joplin may not be the most perfect note-taking application, but it is open-source, well-known, has a long release history, works on multiple operating systems, and supports plugins. It’s not perfect, but it’s good enough and highly usable. In case of this type of application, it is important to have …

Linux
podcast

All podcast applications I have tested were quite OK(ish) – but I have always struggled with organizing podcasts, creating playlists, etc. It has always been challenging. Therefore, for me, it is more convenient to download podcasts as MP3s and manage them myself (in VLC, for example). There are many ways to do that, but my favorite …