Home Operation and Maintenance Linux Operation and Maintenance Log 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
linux Detailed 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 of this Website
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

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

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to view the docker process How to view the docker process Apr 15, 2025 am 11:48 AM

Docker process viewing method: 1. Docker CLI command: docker ps; 2. Systemd CLI command: systemctl status docker; 3. Docker Compose CLI command: docker-compose ps; 4. Process Explorer (Windows); 5. /proc directory (Linux).

What computer configuration is required for vscode What computer configuration is required for vscode Apr 15, 2025 pm 09:48 PM

VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

vscode cannot install extension vscode cannot install extension Apr 15, 2025 pm 07:18 PM

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

Can vscode be used for mac Can vscode be used for mac Apr 15, 2025 pm 07:36 PM

VS Code is available on Mac. It has powerful extensions, Git integration, terminal and debugger, and also offers a wealth of setup options. However, for particularly large projects or highly professional development, VS Code may have performance or functional limitations.

What is vscode What is vscode for? What is vscode What is vscode for? Apr 15, 2025 pm 06:45 PM

VS Code is the full name Visual Studio Code, which is a free and open source cross-platform code editor and development environment developed by Microsoft. It supports a wide range of programming languages ​​and provides syntax highlighting, code automatic completion, code snippets and smart prompts to improve development efficiency. Through a rich extension ecosystem, users can add extensions to specific needs and languages, such as debuggers, code formatting tools, and Git integrations. VS Code also includes an intuitive debugger that helps quickly find and resolve bugs in your code.

How to run java code in notepad How to run java code in notepad Apr 16, 2025 pm 07:39 PM

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

What is the main purpose of Linux? What is the main purpose of Linux? Apr 16, 2025 am 12:19 AM

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

vscode Previous Next Shortcut Key vscode Previous Next Shortcut Key Apr 15, 2025 pm 10:51 PM

VS Code One-step/Next step shortcut key usage: One-step (backward): Windows/Linux: Ctrl ←; macOS: Cmd ←Next step (forward): Windows/Linux: Ctrl →; macOS: Cmd →

See all articles