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
Linux Operations: Managing Files, Directories, and PermissionsLinux Operations: Managing Files, Directories, and PermissionsApr 23, 2025 am 12:19 AM

In Linux, file and directory management uses ls, cd, mkdir, rm, cp, mv commands, and permission management uses chmod, chown, and chgrp commands. 1. File and directory management commands such as ls-l list detailed information, mkdir-p recursively create directories. 2. Permission management commands such as chmod755file set file permissions, chownuserfile changes file owner, and chgrpgroupfile changes file group. These commands are based on file system structure and user and group systems, and operate and control through system calls and metadata.

What is Maintenance Mode in Linux? ExplainedWhat is Maintenance Mode in Linux? ExplainedApr 22, 2025 am 12:06 AM

MaintenanceModeinLinuxisaspecialbootenvironmentforcriticalsystemmaintenancetasks.Itallowsadministratorstoperformtaskslikeresettingpasswords,repairingfilesystems,andrecoveringfrombootfailuresinaminimalenvironment.ToenterMaintenanceMode,interrupttheboo

Linux: A Deep Dive into Its Fundamental PartsLinux: A Deep Dive into Its Fundamental PartsApr 21, 2025 am 12:03 AM

The core components of Linux include kernel, file system, shell, user and kernel space, device drivers, and performance optimization and best practices. 1) The kernel is the core of the system, managing hardware, memory and processes. 2) The file system organizes data and supports multiple types such as ext4, Btrfs and XFS. 3) Shell is the command center for users to interact with the system and supports scripting. 4) Separate user space from kernel space to ensure system stability. 5) The device driver connects the hardware to the operating system. 6) Performance optimization includes tuning system configuration and following best practices.

Linux Architecture: Unveiling the 5 Basic ComponentsLinux Architecture: Unveiling the 5 Basic ComponentsApr 20, 2025 am 12:04 AM

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

Linux Operations: Utilizing the Maintenance ModeLinux Operations: Utilizing the Maintenance ModeApr 19, 2025 am 12:08 AM

Linux maintenance mode can be entered through the GRUB menu. The specific steps are: 1) Select the kernel in the GRUB menu and press 'e' to edit, 2) Add 'single' or '1' at the end of the 'linux' line, 3) Press Ctrl X to start. Maintenance mode provides a secure environment for tasks such as system repair, password reset and system upgrade.

Linux: How to Enter Recovery Mode (and Maintenance)Linux: How to Enter Recovery Mode (and Maintenance)Apr 18, 2025 am 12:05 AM

The steps to enter Linux recovery mode are: 1. Restart the system and press the specific key to enter the GRUB menu; 2. Select the option with (recoverymode); 3. Select the operation in the recovery mode menu, such as fsck or root. Recovery mode allows you to start the system in single-user mode, perform file system checks and repairs, edit configuration files, and other operations to help solve system problems.

Linux's Essential Components: Explained for BeginnersLinux's Essential Components: Explained for BeginnersApr 17, 2025 am 12:08 AM

The core components of Linux include the kernel, file system, shell and common tools. 1. The kernel manages hardware resources and provides basic services. 2. The file system organizes and stores data. 3. Shell is the interface for users to interact with the system. 4. Common tools help complete daily tasks.

Linux: A Look at Its Fundamental StructureLinux: A Look at Its Fundamental StructureApr 16, 2025 am 12:01 AM

The basic structure of Linux includes the kernel, file system, and shell. 1) Kernel management hardware resources and use uname-r to view the version. 2) The EXT4 file system supports large files and logs and is created using mkfs.ext4. 3) Shell provides command line interaction such as Bash, and lists files using ls-l.

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 Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.