Introduction and usage of Linux remote operation HTTP/FTP commands - ftp/wget/curl/lynx/ncftp/aria2c/axel/lftp/wgetpaste/w3m

Parameter introduction and detailed examples of 10 commands used to download files or access web pages from remote HTTP or FTP servers in Linux and Unix operating systems:

1. wget

Commonly used parameters:

  • -O: Specify the saving path and file name of the downloaded file.
  • -c: Resume downloading from a breakpoint. If the download is interrupted, the download can be resumed from where it was interrupted.

Example:

# 下载文件并保存到指定路径
wget -O /path/to/local/file.zip http://example.com/file.zip

# 断点续传,如果下载中断可以从中断的地方继续下载
wget -c http://example.com/file.zip

2. curl

Commonly used parameters:

  • -o: Specify the saving path and file name of the downloaded file.
  • -L: Automatic redirection, if the download link is redirected, automatically follow the redirect link to download.

Example:

# 下载文件并保存到指定路径
curl -o /path/to/local/file.zip http://example.com/file.zip

# 自动重定向,如果下载链接被重定向,自动跟随重定向链接下载
curl -L http://example.com/file.zip

3. lynx

Commonly used parameters:

  • -dump: Output web page content to the terminal.

Example:

# 输出网页内容到终端
lynx -dump http://example.com/index.html

4. ftp

Commonly used parameters:

  • get: Specify the file to download.
  • -u: Specify the user name to log in to the FTP server.
  • -p: Specify the password to log in to the FTP server.

Example:

# 将远程 FTP 服务器上的文件下载到本地
ftp -u ftp://ftp.example.com/file.txt /path/to/local/file.txt

# 登录 FTP 服务器并下载文件
ftp -u ftp://ftp.example.com/file.txt -user username -password password

5. ncftp

Commonly used parameters:

  • get: Specify the file to download.
  • -u: Specify the user name to log in to the FTP server.
  • -p: Specify the password to log in to the FTP server.

Example:

# 将远程 FTP 服务器上的文件下载到本地
ncftpget ftp://ftp.example.com/file.txt /path/to/local/file.txt

# 登录 FTP 服务器并下载文件
ncftpget ftp://ftp.example.com/file.txt -u username -p password

6. aria2c

Commonly used parameters:

  • -o: Specify the saving path and file name of the downloaded file.
  • -s: Number of simultaneous download connections.
  • -x: The maximum number of threads used per connection.

Example:

# 下载文件并保存到指定路径
aria2c -o /path/to/local/file.zip http://example.com/file.zip

# 同时下载 4 个连接
aria2c -s 4 http://example.com/file.zip

# 每个连接使用 2 个线程
aria2c -x 2 http://example.com/file.zip

7. axel

Commonly used parameters:

  • -o: Specify the saving path and file name of the downloaded file.
  • -n: Number of simultaneous download connections.

Example:

# 下载文件并保存到指定路径
axel -o /path/to/local/file.zip http://example.com/file.zip

# 同时下载 4 个连接
axel -n 4 http://example.com/file.zip

8. lftp

Commonly used parameters:

  • -c:Specify the command to be executed.

Example:

# 登录 FTP 服务器并下载文件
lftp -c "open ftp://ftp.example.com; get file.txt"

# 执行多个命令
lftp -c "open ftp://ftp.example.com; cd /path/to/remote/dir; get file.txt"

9. wgetpaste

Commonly used parameters:

  • none.

Example:

# 将文件上传到远程服务器并生成 URL 地址
wgetpaste file.txt

10.w3m

Commonly used parameters:

  • -dump: Output web page content to the terminal.

Example:

# 输出网页内容到终端
w3m -dump http://example.com/index.html

The above is the parameter introduction and detailed examples of some commonly used commands for downloading files or accessing web pages from remote HTTP or FTP servers in Linux and Unix operating systems. It should be noted that different commands may have different parameter options. For specific usage methods, you can view the help document or online documentation of the command.

Guess you like

Origin blog.csdn.net/holyvslin/article/details/132080184
Recommended