linux 命令 ftp_Linux和Windows的FTP命令列表以及示例

本文介绍了如何在Linux和Windows操作系统中使用FTP命令来执行各种操作,如连接远程服务器、下载和上传文件、更改目录、显示文件信息等。这些命令包括open、cd、get、put、ls、dir、quit等,对于日常的文件传输非常实用。
摘要由CSDN通过智能技术生成
linux 命令 ftp

linux 命令 ftp

FTP protocol and tools are used to transfer data over network in a simple manner. There are different FTP tools with GUI support which can provide simple usage without knowing any command but in some cases we may need to use FTP commands. In this tutorial we will learn how to use FTP commands with example in operating systems like Windows and Linux.

FTP协议和工具用于以简单方式通过网络传输数据。 有多种具有GUI支持的FTP工具,它们可以在不知道任何命令的情况下提供简单的用法,但是在某些情况下,我们可能需要使用FTP命令。 在本教程中,我们将学习如何在Windows和Linux等操作系统中使用FTP命令作为示例。

逃脱壳 (Escape Shell)

!

执行宏 (Execute Macro)

Defined macros can be executed with the $ by providing the macro name. In this example we will run macro named test

通过提供宏名称,可以使用$执行定义的宏。 在此示例中,我们将运行名为test

$test

打印本地帮助信息 (Print Local Help Information)

We can print help information about local commands with ?

我们可以使用?打印有关本地命令的帮助信息?

?
Print Local Help Information
Print Local Help Information
打印本地帮助信息

将帐户命令发送到远程服务器(Send Account Command To Remote Server)

After connecting an FTP server we can change the current user with account command. This will as for the USER and PASS information.

连接FTP服务器后,我们可以使用account命令更改当前用户。 这将与USER和PASS信息相同。

account

附加到文件 (Append To A File)

We can append into existing file with append command like below.

我们可以使用如下所示的append命令将其追加到现有文件中。

append

设置ASCII传输类型 (Set ASCII Transfer Type)

There are different transfer types. We can use ascii to change text transfer mode.

有不同的传输类型。 我们可以使用ascii更改文本传输模式。

ascii

命令完成时发出提示音 (Beep When Command Completed)

beep command will play sound after the given command is completed.

给定命令完成后, beep命令将播放声音。

beep

设置二进制传输类型 (Set Binary Transfer Type)

Other than ascii type there is also binary transfer type where there will be no translation during transfer.

ascii类型外,还有binary传输类型,在传输过程中不会进行翻译。

binary

终止FTP会话并退出 (Terminate FTP Session and Exit)

We can terminate current FTP session and exit from FTP shell with bye command like below.

我们可以使用下面的bye命令终止当前的FTP会话并从FTP Shell退出。

Terminate FTP Session and Exit
Terminate FTP Session and Exit
终止FTP会话并退出
bye

切换区分大小写 (Toggle Case Sensitivity)

Case sensitivity can be enabled or disabled with case command like below.

可以使用如下case命令启用或禁用case

case

更改远程工作目录 (Change Remote Working Directory)

We can change current working directory of the remote system or server with the cd command. In this example we will navigate to the remote directory Mirror

我们可以使用cd命令更改远程系统或服务器的当前工作目录。 在此示例中,我们将导航到远程目录Mirror

cd Mirror
Change Remote Working Directory
Change Remote Working Directory
更改远程工作目录

将远程目录更改为父目录(Change Remote Directory To Parent Directory)

cdup will automatically change current working directory of remote system to the parent or single upper level.

cdup会自动将远程系统的当前工作目录更改为父级或单个上级目录。

cdup

更改远程文件权限 (Change Remote File Permissions)

If we have enough privileges we can change remote system file permissions iwth chmod like in Linux systems.

如果我们有足够的特权,我们可以像在Linux系统中那样使用chmod更改远程系统文件的权限。

chmod

终止FTP会话 (Terminate FTP Session)

Another command to terminate FTP sessions but this command will not exit from interactive FTP shell.

另一个终止FTP会话的命令,但该命令不会从交互式FTP Shell中退出。

close
Terminate FTP Session
Terminate FTP Session
终止FTP会话

启用/禁用回车剥离(Enable/Disable Carriage Return Stripping)

cr

启用/禁用调试 (Enable/Disable Debugging)

If we have problem about executing commands we may need more information. We can run commands in verbose mode with debug command.

如果我们对执行命令有疑问,我们可能需要更多信息。 我们可以使用debug命令以详细模式运行命令。

debug
Enable/Disable Debugging
Enable/Disable Debugging
启用/禁用调试

删除远程文件(Delete Remote File)

We can delete remote file with delete command. In this exmaple we will delete file named old.txt

我们可以使用delete命令删除远程文件。 在此old.txt我们将删除名为old.txt文件

delete old.txt

列出远程目录的内容 (List Contents of Remote Directory)

We can list contents , files and folders of the remote system with the dir command like below.

我们可以使用dir命令列出远程系统的内容,文件和文件夹,如下所示。

$ dir
List Contents of Remote Directory
List Contents of Remote Directory
列出远程目录的内容

终止FTP会话(Terminate FTP Session)

We can close current FTP session or connection but stay in the FTP shell with disconnect command.

我们可以关闭当前的FTP会话或连接,但可以使用disconnect命令保留在FTP Shell中。

disconnect
Terminate FTP Session
Terminate FTP Session
终止FTP会话

终止FTP会话并退出(Terminate FTP Session and Exit)

We can terminate current FTP session and exit from FTP shell with exit command.

我们可以终止当前的FTP会话,并使用exit命令从FTP Shell exit

exit
Terminate FTP Session and Exit
Terminate FTP Session and Exit
终止FTP会话并退出

设置文件传输格式(Set File Transfer Format)

form

接收档案 (Receive File)

We can download from remote system with get command. We will download file named timestamp.txt in this example.

我们可以使用get命令从远程系统下载。 在此示例中,我们将下载名为timestamp.txt文件。

get timestamp.txt
Receive File
Receive File
接收档案

显示本地帮助信息(Display Local Help Information)

help
Display Local Help Information
Display Local Help Information
显示本地帮助信息

设置二进制传输类型(Set Binary Transfer Type)

image

允许使用任何IP地址族 (Allow Use Of Any IP Address Family)

ipany

仅保留IPv4 (Resctrict Only IPv4)

ipv4

仅限制IPv6 (Restrict Only IPv6)

ipv6

更改本地工作目录 (Change Local Working Directory)

As we work also local system we can change local directory with lcd command.

当我们也在本地系统上工作时,我们可以使用lcd命令更改本地目录。

lcd Downloads/
Change Local Working Directory
Change Local Working Directory
更改本地工作目录

列出远程目录的内容(List Contents Of Remote Directory)

The one of the most popular FTP command is ls which will list contents, files, folders of the remote system.

最受欢迎的FTP命令之一是ls ,它将列出远程系统的内容,文件,文件夹。

ls
List Contents Of Remote Directory
List Contents Of Remote Directory
列出远程目录的内容

定义宏(Define Macro)

macdef

删除多个文件 (Delete Multiple Files)

We can delete multiple files and folders with a single command. In this example we will delete files named 1.txt , 2.txt , 3.txt

我们可以使用一个命令删除多个文件和文件夹。 在此示例中,我们将删除名为1.txt2.txt3.txt

mdelete 1.txt 2.txt 3.txt

在远程上创建目录 (Create Directory On Remote)

We can create a directory on the remote system with mkdir command. In this example we will create directory named backup

我们可以使用mkdir命令在远程系统上创建目录。 在此示例中,我们将创建名为backup目录。

mkdir backup

列出多个远程目录的内容 (List Contents Of Multiple Remote Directories)

mls

设置文件传输模式 (Set File Transfer Mode)

mode

显示远程文件的最后修改时间 (Show Last Modification Time Of Remote File)

We can show last modification time of the file on the remote system with modtime command. We will list modification time of the  filelist.gz on the remote system.

我们可以使用modtime命令显示远程系统上文件的最后修改时间。 我们将列出远程系统上filelist.gz修改时间。

modtime filelist.gz
Show Last Modification Time Of Remote File
Show Last Modification Time Of Remote File
显示远程文件的最后修改时间

发送多个文件(Send Multiple Files)

We can put multiple files with mput command. In this example we will send files 1.txt , 2.txt , 3.txt

我们可以使用mput命令放置多个文件。 在此示例中,我们将发送文件1.txt2.txt3.txt

mput

如果远程文件比本地文件新,则获取文件 (Get File If Remote File Is Newer Than Local File)

We can only get file if remote file is newer then local file. In this example we check remote file 1.txt with local file 1.txt

如果远程文件比本地文件新,我们只能获取文件。 在此示例中,我们检查远程文件1.txt与本地文件1.txt

newer 1.txt 1.txt

列出远程目录的内容 (List Contents Of Remote Directory)

nlist

将模板设置为默认文件名映射 (Set Template For default File Name Mapping)

nmap

为默认文件名映射设置转换表 (Set Translation Table For Default File Name Mapping)

ntrans

连接远程FTP服务器和端口 (Connect Remote FTP Server and Port)

We can connect to the FTP server with open command from FTP shell. In this example we will connect to the ftp.itu.edu.tr .

我们可以使用来自FTP shell的open命令连接到FTP服务器。 在此示例中,我们将连接到ftp.itu.edu.tr

open ftp.itu.edu.tr
Connect Remote FTP Server and Port
Connect Remote FTP Server and Port
连接远程FTP服务器和端口

进入被动传输模式(Enter Passive Transfer Mode)

passive

强制交互式提示多个命令 (Force Interactive Prompting on Multiple Commands)

prompt

在备用连接上发出命令 (Issue Command On Alternate Connection)

proxy

发送单个文件 (Send Single File)

We can use put command in order to send single file to the FTP server. In this example we will send file named data.txt to the remote system.

我们可以使用put命令将单个文件发送到FTP服务器。 在此示例中,我们将名为data.txt文件发送到远程系统。

put data.txt

在远程系统上打印工作目录 (Print Working Directory on Remote System)

We can print and list current working directory of the remote system or server. We will use pwd without any option.

我们可以打印并列出远程系统或服务器的当前工作目录。 我们将不带任何选项使用pwd

pwd
Print Working Directory on Remote System
Print Working Directory on Remote System
在远程系统上打印工作目录

打印? 代替控制字符 (Print ? In Place Of Control Characters)

qc

终止FTP会话并退出 (Terminate FTP Session and Exit)

Another good command in order to terminate FTP session and exit from FTP shell.

另一个好命令,以终止FTP会话并从FTP Shell退出。

quit
Terminate FTP Session and Exit
Terminate FTP Session and Exit
终止FTP会话并退出

发送任意FTP命令(Send Arbitrary FTP Command)

quote

接收档案 (Receive File)

Another good command in order to download file from remote FTP server we will use recv command with the file name we want to download. In this example we will download file named timestamp.txt .

为了从远程FTP服务器下载文件,另一个很好的命令是我们将recv命令与我们要下载的文件名一起使用。 在此示例中,我们将下载名为timestamp.txt文件。

recv timestamp.txt
Receive File
Receive File
接收档案

在本地文件末尾获取重新启动的文件(Get File Restarting At End Of Local File)

reget

重新命名文件 (Rename File)

We can rename a remote file. We will use rename with the current name of file and new name of the file. We will rename file named data.txt into newdata.txt

我们可以重命名一个远程文件。 我们将使用rename以及文件的当前名称和文件的新名称。 我们将名为data.txt文件重命名为newdata.txt

rename data.txt newdata.txt

清除排队的命令答复 (Clear Queued Command Replies)

reset

重新启动文件传输(按字节计数) (Restart File Transfer At Byte Count)

restart

从远程服务器获取帮助 (Get Help From Remote Server)

rhelp

删除远程系统上的目录 (Remove Directory On Remote System)

We can remote a directory on the remote FTP server or system with rmdir by providing the directory name. In this example we will remove directory named old

通过提供目录名称,我们可以使用rmdir在远程FTP服务器或系统上远程目录。 在此示例中,我们将删除名为old目录

rmdir old

显示远程系统的状态 (Show Status Of Remote System)

After connecting remote FTP server or system we can print current status about the remote system and connection with the rstatus command.

连接远程FTP服务器或系统后,我们可以使用rstatus命令打印有关远程系统和连接的当前状态。

rstatus
Show Status Of Remote System
Show Status Of Remote System
显示远程系统的状态

We can see that there are following information

我们可以看到以下信息

  • Connected IP address

    连接的IP地址
  • Mode or Type which is ASCII in this case

    在这种情况下为ASCII的模式或类型
  • Sessions bandwith limit which is unlimited in this example

    会话带宽限制,在此示例中是无限的
  • Sessions timeout which is 300 seconds in this example

    会话超时,在此示例中为300秒
  • Control connection type which is plain text in this example

    控制连接类型,在此示例中为纯文本
  • Data connection type which is plain text in this example

    数据连接类型,在此示例中为纯文本
  • Connected client count to the remote FTP server which is 2 in this example

    连接的客户端数到远程FTP服务器,在此示例中为2
  • Server software name and version with its banner which is vsFTPd 2.2.2 in this example

    在此示例中,服务器软件名称和版本及其标语为vsFTPd 2.2.2
LEARN MORE  How To Add New Route In Ubuntu, Linux?
了解更多如何在Ubuntu,Linux中添加新路由?

切换本地文件的唯一存储 (Toggle Store Unique for Local File)

runique

发送一个文件 (Send One file)

We can send a single file to the remote server with the send command by specifying file name. In this example we will send file named data.txt

通过指定文件名,我们可以使用send命令将单个文件发送到远程服务器。 在此示例中,我们将发送名为data.txt文件

send data.txt

为每个数据连接启用/禁用端口 (Enable/Disable Use Of PORT For Each Data Connection)

sendport

显示远程文件的大小 (Show Size Of Remote File)

We can print the size of the given file on the remote server with size command and providing the file name. In this example we will print the size of the filelist.gz

我们可以使用size命令并提供文件名在远程服务器上打印给定文件的size 。 在此示例中,我们将打印filelist.gz的大小。

size filelist.gz
Show Size Of Remote File
Show Size Of Remote File
显示远程文件的大小

显示当前状态(Show Current Status)

We can print current status of the connection and technical details with status command.

我们可以使用status命令打印连接的当前状态和技术详细信息。

status
Show Current Status
Show Current Status
显示当前状态

设置文件传输结构(Set File Transfer Structure)

struct

在远程系统上切换唯一存储 (Toggle Store Unique On Remote System)

sunique

显示远程系统类型 (Show Remote System Type)

While working with remote FTP server operating system is important. We can get information about remote system with system command like below.

在使用远程FTP服务器时,操作系统很重要。 我们可以使用以下system命令获取有关远程系统的信息。

system
Show Remote System Type
Show Remote System Type
显示远程系统类型

设置Tenex文件传输类型(Set Tenex File Transfer Type)

tenex

传输期间启用/禁用打印字节计数器 (Enable/Disable Printing Byte Counter During Transfers)

tick

启用/禁用软件包跟踪 (Enable/Disable Package Tracing)

trace

设置文件传输类型 (Set File Transfer Type)

type

在远程系统上获取Umask (Get Umask On Remote System)

umask

发送新的用户信息 (Send New User Information)

We can relogin with different user name by using user command. We will provide user name and password interactively.

我们可以使用user命令以不同的用户名重新登录。 我们将以交互方式提供用户名和密码。

user
Send New User Information
Send New User Information
发送新的用户信息

启用/禁用详细模式(Enable/Disable Verbose Mode)

Like debug mode with can enable and disable verbose mode with verbose command like below.

像debug mode with可以通过如下的verbose命令启用和禁用verbose模式。

verbose
Enable/Disable Verbose Mode
Enable/Disable Verbose Mode
启用/禁用详细模式

翻译自: https://www.poftut.com/list-of-ftp-commands-for-linux-and-windows-with-examples/

linux 命令 ftp

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值