search
HomeOperation and MaintenanceLinux Operation and MaintenanceLog in to ftp under linux, detailed explanation of lftp command

Log in to ftp under linux, detailed explanation of lftp command

Sep 04, 2017 pm 02:16 PM
linuxDetailed explanation

Use lftp

1. Log in to ftp

Code:

lftp Username: Password@ftp address: Transfer port (default 21)

Usage

(1)lftp username:password@127.0.0.1:21 Enter

(2)lftp username@127.0.0.1 Enter ##Default port 21 Enter password after entering

(3)lftp 127.0.0.1 Enter ##Enter and log in

(4)lftp Enter--> open 127.0.0.1 --> login Login

I feel a lot like Kong Yiji. There are several ways to write "fennel" in fennel beans! ~So dizzy~

2. lftp Chinese garbled code problem

For a novice like me, after logging in, all I see is Chinese garbled code (because generally the local encoding is utf-8) ), why not, use the set command to solve it

set ftp:charset gbk (or gb2312 or utf-8) ##Set the encoding format of the ftp end

set file:charset utf-8 (...Same as above) ##Set the local encoding format

Attachment: Tips for the set command (1) Enter set to view the set commands (2) set -a to view all the commands that can be set

3. Find ftp side files

ls *.txt ##Find all txt files in the current directory

ls ./123/ ##List all files in the 123 directory

find . -name "*.txt" ##Recursively search for all txt files on the site

find ./xx -name "*.txt" ##Find all txt files in the xx directory File

Attachment 1: The second time ls reads is the local cache, you can use rels instead of ls or catch off / catch on to switch catch, catch flush clears the local catch

Attachment 2: You can use !ls to browse local directories, such as !ls /usr/local/bin/

4. Download files

Before downloading files, you must first set up a local directory to store downloads. File

lcd /home/123/web ##Set the local storage directory to /home/usr by default

get 123.txt ##Download the 123.txt file to /home/123/ In web

get -c 123.txt ##Resumable download

mget *.txt ##Batch download all txt files

mget -c *.txt ##Resume breakpoint transmission

mget -c ./123/aaa/*.txt ##Resume breakpoint transmission, batch download all txt files in the aaa directory on the ftp end

pget - c -n 10 file.dat

##Download file.dat

##with up to 10 threads allowing resumed downloading

##Can be set by set pget:default-n 5 value and use the default value.

mirror aaa/

##Download the entire aaa directory, and the subdirectories will be automatically copied to the local directory and automatically created

5. Upload files

put 123.txt ##Same as download

mput *.txt ##Same as download

mirror -R aaa/ ##Same as download

6. Set passive/non Passive mode

set ftp:passive-mode 1 ## 1 passive 0 non-active

Multi-tasking

ctrl+z ##Transfer the current task to the background for processing

wait ##Move background processing tasks to the foreground to view

jobs ##View the list of tasks performed in the background

kill all or job_no ##Delete all tasks or the specified Task

##Add task to task list

queue get 123.txt

queue put 234.txt

queue mirror aaa/

queue ##View task list

jobs ##View background task list

queue start ##Start task list

queue stop ##Stop task list

Other commands

alias []

Define alias

alias less more

alias reconnect "close; cd ."

Enter alias directly to see which aliases are currently defined. If you only enter alias name, the alias name will be cancelled.

bookmark SUBCMD

Set bookmarks. You can set the current site and directory as bookmarks. You can enter directly next time without having to cd back and forth.

bookmark add name is used to add a bookmark named name

bookmark del name Delete the bookmark named name

bookmark list Displays the currently set bookmarks (in addition, directly type the results of bookmark and bookmark list) Same)

bookmark edit Call the editor to modify bookmarks (~/.lftp/bookmarks)

cd Switch remote directory

cache SUBCMD

Manage lftp cache

rels []

Display remote file list from cache

rels will not be read from cache

recls opts [path /]pattern

Displays the remote file list from the cache. It should be regarded as an enhanced version of ls. There are many parameters available. It should be used to generate various file lists for use by other programs.

recls will not be read from the cache

du options

Calculate the capacity occupied by the entire remote directory

get OPTS -o

Grab remote files

get rfile -o lfile

Grab rfile and rename it locally to lfile

-c for resume transfer

-E After the file grabbing is completed, cut the remote files

-a to ascii mode, the default is binary mode

-O Set the base directory to the local directory where the files are placed

mget OPTS

Download remote files (wildcard expansion is available, that is, *)

pget OPTS -o

Use multiple links to download files, default for five.

-n 3 For three links

jobs -v

Display which programs are currently running in the background

-v Display detailed information (- v You can add a few more to display more detailed information)

lcd

Switch the local directory

mirror OPTS remote [local]

###Download the entire directory (The get upstairs can only be used to grab files)###

-c Resume

-e Be careful with this. Compare the remote and local files. If the remote files are not available, delete the local files, that is, combine the local and remote data. Synchronize.

-R Upload the entire directory

-n Download only newer files

-r No need to pass back to the directory

--parallel=n Download n files at the same time (default is to download only one at a time)

module name args

Load module

put OPTS -o

Upload file

mput OPTS

Upload files (wildcard expansion can be used, that is, *)

mv

Rename the remote file1 to file2

mrm

Use wildcard expansion to delete remote files

open OPTS

Open a site

open -u, -p site

queue OPTS []

Put cmd in the queue and wait for execution

-d index Delete the job numbered index

-m index new_index Will The job numbered index is moved to number new_index, which is only used for queue jumping.

-n index Add a new job before the number index

wait []

Move the program executing in the background to the foreground (fg can also be used)

kill all|

Delete all jobs or job_no

repeat delay command

Repeat command every delay seconds, the default is every second

rm -r -f

Remove remote files

mkdir -p

Create remote directory

rmdir -f

Remove the remote directory

set OPT []

Set variables

Type set directly to see which variables are currently defined

source

Read file and execute the command in file (it should be the same as the source command in bash)

debug [|off] -o

Set Set the debug level to level

-o and direct the output to file

exit [|bg]

End lftp

If there are still jobs at this time, Then lftp will be executed in the background and continue the unfinished work

history -w file-r file-c|-l cnt

The function is the same as the history in bash

renlist []

Only display the remote file name

pwd -p

Display the current remote directory

-p even with the login password Also displays

scache []

Only scache shows all current sessions, plus session_no can switch to other sessions,

For opening multiple sites at the same time or Switch between different directories on the same site.

The above is the detailed content of Log in to ftp under linux, detailed explanation of lftp command. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
The 5 Core Components of the Linux Operating SystemThe 5 Core Components of the Linux Operating SystemMay 08, 2025 am 12:08 AM

The five core components of the Linux operating system are: 1. Kernel, 2. System libraries, 3. System tools, 4. System services, 5. File system. These components work together to ensure the stable and efficient operation of the system, and together form a powerful and flexible operating system.

The 5 Essential Elements of Linux: ExplainedThe 5 Essential Elements of Linux: ExplainedMay 07, 2025 am 12:14 AM

The five core elements of Linux are: 1. Kernel, 2. Command line interface, 3. File system, 4. Package management, 5. Community and open source. Together, these elements define the nature and functionality of Linux.

Linux Operations: Security and User ManagementLinux Operations: Security and User ManagementMay 06, 2025 am 12:04 AM

Linux user management and security can be achieved through the following steps: 1. Create users and groups, using commands such as sudouseradd-m-gdevelopers-s/bin/bashjohn. 2. Bulkly create users and set password policies, using the for loop and chpasswd commands. 3. Check and fix common errors, home directory and shell settings. 4. Implement best practices such as strong cryptographic policies, regular audits and the principle of minimum authority. 5. Optimize performance, use sudo and adjust PAM module configuration. Through these methods, users can be effectively managed and system security can be improved.

Linux Operations: File System, Processes, and MoreLinux Operations: File System, Processes, and MoreMay 05, 2025 am 12:16 AM

The core operations of Linux file system and process management include file system management and process control. 1) File system operations include creating, deleting, copying and moving files or directories, using commands such as mkdir, rmdir, cp and mv. 2) Process management involves starting, monitoring and killing processes, using commands such as ./my_script.sh&, top and kill.

Linux Operations: Shell Scripting and AutomationLinux Operations: Shell Scripting and AutomationMay 04, 2025 am 12:15 AM

Shell scripts are powerful tools for automated execution of commands in Linux systems. 1) The shell script executes commands line by line through the interpreter to process variable substitution and conditional judgment. 2) The basic usage includes backup operations, such as using the tar command to back up the directory. 3) Advanced usage involves the use of functions and case statements to manage services. 4) Debugging skills include using set-x to enable debugging mode and set-e to exit when the command fails. 5) Performance optimization is recommended to avoid subshells, use arrays and optimization loops.

Linux Operations: Understanding the Core FunctionalityLinux Operations: Understanding the Core FunctionalityMay 03, 2025 am 12:09 AM

Linux is a Unix-based multi-user, multi-tasking operating system that emphasizes simplicity, modularity and openness. Its core functions include: file system: organized in a tree structure, supports multiple file systems such as ext4, XFS, Btrfs, and use df-T to view file system types. Process management: View the process through the ps command, manage the process using PID, involving priority settings and signal processing. Network configuration: Flexible setting of IP addresses and managing network services, and use sudoipaddradd to configure IP. These features are applied in real-life operations through basic commands and advanced script automation, improving efficiency and reducing errors.

Linux: Entering and Exiting Maintenance ModeLinux: Entering and Exiting Maintenance ModeMay 02, 2025 am 12:01 AM

The methods to enter Linux maintenance mode include: 1. Edit the GRUB configuration file, add "single" or "1" parameters and update the GRUB configuration; 2. Edit the startup parameters in the GRUB menu, add "single" or "1". Exit maintenance mode only requires restarting the system. With these steps, you can quickly enter maintenance mode when needed and exit safely, ensuring system stability and security.

Understanding Linux: The Core Components DefinedUnderstanding Linux: The Core Components DefinedMay 01, 2025 am 12:19 AM

The core components of Linux include kernel, shell, file system, process management and memory management. 1) Kernel management system resources, 2) shell provides user interaction interface, 3) file system supports multiple formats, 4) Process management is implemented through system calls such as fork, and 5) memory management uses virtual memory technology.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use