linux使用ftp命令_如何使用Linux FTP命令

linux使用ftp命令

FTP (File Transfer Protocol), is a protocol commonly used for the transfer of files between a client and a server. In this guide, you will learn how to use Linux FTP commands with practical examples. Without much further ado, let’s jump right in.

FTP(文件传输协议)是一种通常用于在客户端和服务器之间传输文件的协议。 在本指南中,您将通过实际示例学习如何使用Linux FTP命令。 事不宜迟,让我们直接进入。

先决条件 (Prerequisite)

VSFTPD (Very Secure File Transfer Protocol Daemon) installed and properly configured. It’s also crucial to point out that you must have read permissions from the source file and write permissions on the FTP server. This enables you to transfer files to and fro in a secure/encrypted manner.

VSFTPD (非常安全的文件传输协议守护程序)已安装并正确配置。 同样重要的是要指出您必须具有对源文件的读取权限,并且必须对FTP服务器具有写入权限。 这使您能够以安全/加密的方式来回传输文件。

1.建立FTP连接 (1. Establishing an FTP connection)

To establish an FTP connection with a remote server, use the syntax below on the terminal

要与远程服务器建立FTP连接,请在终端上使用以下语法

# ftp ip-address

For example ,

例如 ,

# ftp 38.76.11.174

Upon establishing a connection, you will thereafter be prompted for a username and a password

建立连接后,系统将提示您输入用户名和密码

Output

输出量

If the username and password details were correct, you will get a ‘login successful’ notification on the terminal alongside the FTP system type.

如果用户名和密码详细信息正确,则您将在终端上与FTP系统类型一起收到“登录成功”的通知。

2.常用的FTP命令 (2. Commonly used FTP commands)

Once in the ftp prompt, let’s examine some of the commonly used command options.

进入ftp提示符后,让我们检查一些常用的命令选项。

  1. ? or help – This displays all available FTP commands

    ? or help ? or help -显示所有可用的FTP命令
  2. ls – This lists all the files and directories in the current remote directory

    ls –列出当前远程目录中的所有文件和目录
  3. lcd – This dislays the current directory in the local machine

    lcd –这会在本地计算机上显示当前目录
  4. put – Uploads or copies a file from the local machine to the remote FTP server

    put –将文件从本地计算机上载或复制到远程FTP服务器
  5. mput– Uploads or copies multiple files from the local machine to the remote FTP server

    mput –将多个文件从本地计算机上载或复制到远程FTP服务器
  6. get – Downloads or copies files from the remote FTP server to the local machine

    get –将文件从远程FTP服务器下载或复制到本地计算机
  7. mget – Downloads or copies mutiple files from the remote FTP server to the local machine

    mget –将多个文件从远程FTP服务器下载或复制到本地计算机
  8. mkdir – Creates a new directory in the current remote directory

    mkdir –在当前远程目录中创建一个新目录
  9. rmdir – Deletes a directory in the current remote directory

    rmdir –删除当前远程目录中的目录
  10. delete– Delete a directory in the current remote directory

    delete –删除当前远程目录中的目录

3.使用FTP命令上传文件 (3. Uploading files using FTP command)

To upload or copy a file to an FTP server, first ensure that you are connecting to the FTP server from the directory containing the files you want to upload.

要将文件上传或复制到FTP服务器,请首先确保您从包含要上传文件的目录连接到FTP服务器。

Once logged in, use the syntax

登录后,使用语法

ftp> put file_name

For example

例如

ftp> put hello.sh

Output

输出量

To upload multiple files , use the mput command as shown.

要上传多个文件,请使用mput命令,如图所示。

ftp> mput file1 file2 ...

For example

例如

ftp> mput hello.sh output.txt myoutput.txt

You will be prompted for confirmation for each of the files awaiting upload. Press y.

系统将提示您确认每个等待上传的文件。 按y

Output

输出量

4.使用FTP命令下载文件 (4. Downloading files using FTP command)

To download a file from the FTP server , use the get command as shown

要从FTP服务器下载文件,请使用get命令,如下所示

ftp> get file_name

For example

例如

ftp> get install.sh

Output

输出量

For multiple files, use the mget command as shown

对于多个文件,请使用mget命令,如下所示

ftp> mget file1 file2 ...

For instance ,

例如 ,

ftp> mget file1.txt file2.txt file3.txt

Output

输出量

5.获得帮助 (5. Getting help)

To list all the options that are available for use with the ftp command, execute.

要列出所有可用于ftp命令的选项,请执行。

help

OR

要么

?

Output

输出量

6.关于GUI FTP客户端的说明 (6. A note about GUI FTP clients)

One of the drawbacks of transferring files via the terminal is time wasted uploading or downloading files one by one. FileZilla is a free and opensource FTP client that allows you to upload or download files and directories over TLS and SFTP. If you have a bulk of files or directories that need to be uploaded or downloaded, then using a GUI based FTP client is highly recommended. Other free GUI FTP clients include

通过终端传输文件的缺点之一是浪费时间一张一张地上传或下载文件。 FileZilla是一个免费的开放源代码FTP客户端,允许您通过TLS和SFTP上传或下载文件和目录。 如果您有大量文件或目录需要上载或下载,则强烈建议使用基于GUI的FTP客户端。 其他免费的GUI FTP客户端包括

  1. WinSCP

    WinSCP
  2. Core FTP

    核心FTP
  3. Coffecup

    咖啡杯

翻译自: https://www.journaldev.com/28491/linux-ftp-commands

linux使用ftp命令

  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值