Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Performing FTP Operations on Linux with Lftp

Tech 1

Installing Lftp

sudo yum install lftp

Connecting to an FTP Server

Provide credentials directly in the URL:

lftp ftp://alice:secret@192.168.1.100:21

Alternatively, connect first and then authenticate interactively:

lftp 192.168.1.100
lftp 192.168.1.100:~> user alice
Password: 
lftp alice@192.168.1.100:~>

Handling Character Encoding

When remote and local systems use different charsets, adjust the session settings:

set ftp:charset gbk
set file:charset utf-8

Navigating Directories

Change the local working directory before transferring files:

lcd /home/user/backups

Switch to the target remote directory:

cd /remote/archives

Uploading Files

Use mirror -R to recursively push a local directory:

mirror -R /home/user/backups/

For single or widlcard file uploads:

put report.log
mput *.csv

Downloading Files

Fetch an entire remote directory with mirror:

mirror /remote/archives/

Download individual files or patterns:

get -c dataset.tar.gz      # -c enables resume support
mget *.txt

Finding Files on the Server

Search recursively for files matchign a pattern:

find . -name "*.conf"

List5000 List items in the current remote directory:

ls *.sh

Advanced Transfer Options

  • Resume partial transfers and control concurrency:
pget -c -n 8 large_video.mp4
  • Force a fresh listing (bypass local cache):
rels
Tags: lftp

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.