Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the lftp command of Linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Today, the editor will share with you the relevant knowledge points about how to use the lftp command of Linux. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look.

Linux common commands lftp command is an excellent file client program, which supports a variety of file transfer protocols such as ftp, SETP, HTTP and FTPs.

Lftp excellent file client program

Add that lftp supports tab auto-completion, do not remember the command double-click the tab key, you can see the possible options.

# Syntax

Lftp (option) (parameter) option-f: specify the script file to be executed by the lftp instruction;-c: exit after executing the specified command;-- help: display help information;-- version: display the version number of the instruction. Parameter site: the ip address or domain name of the site to be visited.

Log in to ftp for an instance

Lftp user name: password @ ftp address: transfer port (default 21) can also log in without a user name, and then use the login command to log in with the specified account under the interface interface. The password is not displayed.

View files and change directories

Download the ftp directory corresponding to ls cd

Of course, get is OK, and it can also:

Mget-c * .pdf # downloads all pdf files in a way that allows breakpoints to resume. Mirror aaa/ # downloads the entire aaa directory and the subdirectories are copied automatically. Pget-c-n 10 file.dat # downloads file.dat with up to 10 threads allowing breakpoint resumes, and you can use the default value by setting the value of pget:default-n. Upload

The same put and mput are all operations on files, similar to downloads.

The mirror-R local directory name uploads the local directory back to ftp site iteratively (including subdirectories).

Mode settin

Set ftp:charset gbk remote ftp site is encoded with gbk, which should be set to utf8, as long as gbk is replaced with utf8.

The local charset of set file:charset utf8 is set to utf8. If you are gbk, change it accordingly.

Set ftp:passive-mode 1 uses passive mode to log in, and some site requires that you must use passive mode or active mode to log in. This switch is set to this. 0 means no passive mode.

Bookmark

In fact, there can also be bookmarks on the command line, at the lftp terminal prompt:

Bookmark add ustc can store the ftp site you are currently browsing with ustc as a tag. In the future, under the shell terminal, direct lftp ustc can automatically fill in the user name and password and enter the corresponding directory.

Bookmark edit invokes the editor to manually modify the bookmark. Of course, you can also see that this bookmark is actually a simple text file. Password, user name can be seen.

Configuration file

Vim / etc/lftp.conf is normal, I will add these lines:

Set ftp:charset gbk set file:charset utf8 set pget:default-n 5 this way, you don't have to type a command every time you enter. Other set can tab themselves and then help to see.

These are all the contents of this article entitled "how to use Linux's lftp commands". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report