Enhanced
Mirroring and Synchronizing
You can use the mirror
command to move a folder or an entire directory tree to a server. Use lpwd
to make sure that you are in the correct local directory. If necessary, change this with lcd
. You can do the same with pwd
and, if necessary, cd
on the server side. The command to upload the directory is simply mirror -R
, the reverse path from the server to the client works with mirror
.
Alternatively, you can specify the directories with the
mirror -R /<Server folder>/ /<Client path>/
command. After the comparison, if you change a file or the file repository in the source directory and then execute the mirror command again, LFTP simply syncs the changes with the other side. The mirror
command also supports several parallel connections, which you can initiate with mirror -P
or define more precisely with:
mirror -parallel=<n>
LFTP plays to one of its strengths in the case of large volume transmissions, in particular by displaying a progress bar and the transmission speed, which you can reduce if required. If a transmission fails once, it can be resumed with the -c
parameter, even if you terminated LFTP in the meantime.
Likewise, LFTP can handle several transmissions at the same time, and they can be sent off into the background as desired and then moved into the foreground again. To view details of the actions performed, take a look at the ~/.lftprc/
directory, where logs of all sessions that document the actions in detail reside.
When all work is complete, exit LFTP with exit
or bye
and return to the shell command line.
Advanced Functions
In addition to transferring files and directories between client and server, LFTP has many additional features and hundreds of control parameters. The most important commands are briefly summarized in Table 1.
Table 1
Command Reference
Command | Function |
---|---|
File Transfers |
|
put <File> |
Transfer file from client to server |
get <File> |
Transfer file from server to client |
Sync Entire Directories |
|
mirror -R |
Sync directory from client to server |
mirror |
Sync directory from server to client |
Bookmarks |
|
bookmark add <Name> |
Create bookmarks |
bookmark list |
List bookmarks |
open <Name> |
Open bookmarks |
Time Control and Batch Processing |
|
at <hh:mm> <Command> |
Specify time |
queue mirror <Folder> |
Create queue (directory) |
queue mirror <File> |
Create queue (just one file) |
queue start |
Start queue |
For example, you can use the at <time>
time control transmission parameter; queue
lets you create queues; and -n <number>
divides the file transmission into several parts. If you want to repeat an action later, create a bookmark with bookmark add <name>
, and bookmark list
lets you view all the bookmarks you have created.
Generally, you can initiate parallel transfers with -P
(--parallel
)=<n>
. LFTP supports FXP transfers from server to server that excludes the client. You can download web pages with HTTP – even the Torrent protocol is supported. LFTP can also be controlled with scripts.
Conclusions
The very powerful and versatile LFTP is comparatively easy to master. Many commands are the same or similar to those of the shell or the conventional FTP command set. The application is still very much active, even after 20 years of development, as can be seen by the release of the fourth update in 2017.
LFTP, on the other hand, lacks up-to-date documentation. Many of the instructions found online are no longer correct. Nevertheless, if you appreciate the command line and want to or need to use FTP, I strongly recommend LFTP as a more powerful alternative.
Infos
- LFTP: https://lftp.yar.ru
- vsftpd: https://security.appspot.com/vsftpd.html
- LFTP command reference: https://www.lifewire.com/lftp-linux-command-4093434
« Previous 1 2 3
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.