LSDF Online Storage lftp: Difference between revisions
From Lsdf
Jump to navigationJump to search
(Created page with "<H1>Using lftp from UNIX client</H1> '''lftp''' is a command-line file transfer program (FTP client) for UNIX and Unix-like systems. Besides FTP, it also supports HTTP, HTT...") |
(Blanked the page) |
||
Line 1: | Line 1: | ||
<H1>Using lftp from UNIX client</H1> |
|||
'''lftp''' is a command-line file transfer program (FTP client) for UNIX and Unix-like systems. |
|||
Besides FTP, it also supports HTTP, HTTPS and '''SFTP''' etc. |
|||
In addition to features common in advanced FTP clients, such as recursively mirroring entire directory trees and resuming downloads, lftp also supports more advanced functionality. Transfers can be scheduled for execution at a later time, bandwidth can be throttled, transfer queues can be created, and Unix shell-like job control is supported. The client can be used interactively or automated with scripts. |
|||
It also has an option called segmented file transfer that allows more than one connection for the same file, bypassing a maximum download speed per file when some servers establish a maximum speed per connection |
|||
<h2>Installation</h2> |
|||
'''Debian:''' |
|||
<pre> |
|||
apt-get install lftp |
|||
</pre> |
|||
'''Suse-Linux:''' |
|||
<pre> |
|||
zypper install lftp |
|||
</pre> |
|||
'''RedHat:''' |
|||
<pre> |
|||
yum install lftp |
|||
</pre> |
|||
<h2>Documentation</h2> |
|||
*lftp home: https://lftp.yar.ru/ |
|||
*lftp man page: https://lftp.yar.ru/lftp-man.html |
|||
*lftp documentation wiki: http://linux.overshoot.tv/wiki/networking/lftp |
|||
<h2>lftp interactive shell</h2> |
|||
You can launch lftp by typing just lftp and then using an '''open''' command to take you to your target site or you can provide the target's name on the same line |
|||
<pre> |
|||
lftp |
|||
lftp :~> open -u xy1234 sftp://os-login.lsdf.kit.edu |
|||
Password: |
|||
lftp xy1234@os-login.lsdf.kit.edu:~> help |
|||
</pre> |
|||
or |
|||
<pre> |
|||
lftp -u xy1234 sftp://os-login.lsdf.kit.edu |
|||
Password: |
|||
lftp 1234@os-login.lsdf.kit.edu:~>help |
|||
</pre> |
|||
<h2>Using lftp to mirror/transfer files</h2> |
|||
<pre> |
|||
#!/bin/bash |
|||
# <<EOF below is the functional equivalent of hitting .Enter. on your keyboard. |
|||
# It allows the rest of the commands to be executed once connected |
|||
# |
|||
# mirror [OPTS] [source [target]] |
|||
# mirror OPTS: |
|||
# -c, --continue continue a mirror job if possible |
|||
# -e, --delete delete files not present at remote site |
|||
# -R, --reverse reverse mirror (put files) |
|||
# -P, --parallel[=N] download N files in parallel |
|||
# -v, --verbose[=level] verbose operation |
|||
# -I GP, --include-glob GP include matching files |
|||
# -r, --no-recursion donât go to subdirectories |
|||
# .... |
|||
lftp -e 'mirror -R /home/localuser/LocalDirToMirror ~/TargetDir' -u YourUsername,YourPassword sftp://os-login.lsdf.kit.edu <<EOF |
|||
quit 0 |
|||
EOF |
|||
</pre> |
|||
'''Example 1:''' |
|||
<pre> |
|||
#!/bin/bash |
|||
lftp -e 'mirror -P 2 -Re ./testdir ~/backupdir' -u 'xy1234:password' sftp://os-login.lsdf.kit.edu <<EOF |
|||
quit 0 |
|||
EOF |
|||
</pre> |
|||
'''Example 2:''' |
|||
<pre> |
|||
#!/bin/bash |
|||
lftp -e "mirror -ceR -I '*.tar' ./testdir ~/backupdir;quit" -u 'xy1234:password' sftp://os-login.lsdf.kit.edu |
|||
</pre> |
|||
<hr> |
|||
<br> |
|||
<br> |
|||
<br> |
|||
<br> |
|||
[[Category:LSDF_Online_Storage|lftp]] |