Lftp Cheatsheet
#
The lftp
command-line client is a sophisticated file transfer program that supports FTP, HTTP, and other protocols.
Basic Commands
#
Command/Option | Example | Description |
---|
lftp | lftp | Start the lftp interactive shell |
lftp -u username | lftp -u user ftp.example.com | Connect to an FTP server with a specified username |
lftp -u username,password | lftp -u user,pass ftp.example.com | Connect with username and password |
lftp -e 'command' | lftp -e 'ls' ftp.example.com | Execute a command and exit |
lftp ftp.example.com | lftp ftp.example.com | Connect to an FTP server |
File Operations
#
Command/Option | Example | Description |
---|
get | get file.txt | Download a file from the remote server |
put | put file.txt | Upload a file to the remote server |
mirror | mirror /local/dir /remote/dir | Mirror directories from local to remote |
mirror -R | mirror -R /local/dir /remote/dir | Mirror directories from remote to local |
Directory Navigation
#
Command/Option | Example | Description |
---|
ls | ls | List files and directories |
cd | cd /path/to/dir | Change directory |
pwd | pwd | Print working directory |
mkdir | mkdir newdir | Create a new directory |
rmdir | rmdir dir | Remove a directory |
Advanced Features
#
Command/Option | Example | Description |
---|
-d | lftp -d ftp.example.com | Enable debug output |
-f | lftp -f script.txt | Read commands from a file |
-c | lftp -c 'ls' ftp.example.com | Execute a command and exit |
-u | lftp -u user,pass ftp.example.com | Connect with username and password |
set | set ftp:ssl-allow true | Configure settings, e.g., SSL |
This cheatsheet covers essential lftp
commands and options for file transfers and directory management.