命令行大全

ftp

小猪老师 发表于 2020-06-23 11:07浏览次数:

将文件传送到运行 FTP 服务器服务(经常称为后台程序)的计算机以及将文件从该计算机 传出。可以交互使用 Ftp。

FTP不是加密的传输,这意味着任何可能拦截您传输的人都可以读取通过它发送的任何数据,包括您的用户名和密码。如果您想要更安全的传输,我们建议使用SFTP。

FTP is not an encrypted transmission, which means any data sent over it, including your username and password, could be read by anyone who may intercept your transmission. If you want a more secure transmission, we suggest using SFTP.

查看英文版

目录:

1 ftp 运行系统环境

2 ftp 语法

3 ftp 示例

ftp 运行系统环境

Windows 95

Windows 98

Windows xp

Windows vista

Windows 2000

Windows 7

Windows 8

Windows 10

Windows NT

Windows ME

All Versions of MS-DOS

ftp 语法

根据FTP和操作系统的版本,以下每个命令可能会起作用,也可能不会起作用。键入-help还是?将列出您可用的命令以下是Windows命令行FTP命令中可用的FTP命令的一般说明。

命令 信息
! 感叹号命令暂时从FTP切换到操作系统。在使用操作系统时,输入exit将带您回到FTP命令行。
? 访问帮助屏幕。
append 将文本追加到本地文件。
ascii 切换到ASCII传输模式。
bell 打开或关闭铃声模式。
binary 切换到二进制传输模式。
bye 退出FTP。
cd 改变目录。
close 退出FTP。
delete 删除一个文件。
debug 设置调试的开启或关闭。
dir 列出连接的文件。

dir -C 将以宽格式列出这些文件。
dir -1 按字母顺序以纯格式列出文件
dir -r 以反字母顺序列出目录。
dir -R 列出当前目录和子目录中的所有文件。
dir -S 按字母顺序列出文件的裸格式。
disconnect 退出FTP。
get 从你连接的电脑中抓取文件。
glob 设置通配符打开或关闭。当关闭时,put和get命令中的文件名按字面意思执行,不使用通配符。
hash 设置hash标记打印打开或关闭。打开时,对于接收到的每1024字节数据,将显示一个hash标记(#)。
help 访问帮助屏幕并显示有关命令的信息(如果命令在帮助之后输入)。
lcd 显示本地目录,如果单独键入,或如果路径键入后lcd,更改本地目录。
literal 向连接的计算机发送一个文字命令,预期有一行响应。
ls 列出远程连接的计算机的文件。
mdelete 多个删除。
mdir 列出多个远程目录的内容。
mget 多个文件。
mkdir 目录。
mls 列出多个远程目录的内容。
mput 发送多个文件
open 打开地址。
prompt 启用或禁用提示符。
put 发送一个文件。
pwd 打印工作目录。
quit 退出FTP。
quote 和文字命令一样。
recv 接收文件。
remotehelp 从远程服务器获得帮助。
rename 重命名一个文件。
rmdir 删除远程计算机上的目录。
send 发送单独的文件。
status 显示当前启用和禁用选项的状态。
trace 切换数据包跟踪。
Type 设置文件传输类型。
user 发送新的用户信息。
verbose 启用或禁用详细设置

FTP commands

Depending on the version of FTP and the operating system, each of the following commands may or may not work. Typing -help or a ? will list the commands available to you. Below is a general description of FTP commands available in the Windows command line FTP command.

Command Information
! The exclamation point command switches temporarily from FTP to operating system. When using the operating system, typing exit takes you back to the FTP command line.
? Access the help screen.
append Append text to a local file.
ascii Switch to ASCII transfer mode.
bell Turns bell mode on or off.
binary Switches to binary transfer mode.
bye Exits from FTP.
cd Changes directory.
close Exits from FTP.
delete Deletes a file.
debug Sets debugging on or off.
dir Lists files if connected.

dir -C will list the files in wide format.
dir -1 lists the files in bare format in alphabetic order
dir -r lists directory in reverse alphabetic order.
dir -R lists all files in current directory and subdirectories.
dir -S lists files in bare format in alphabetic order.
disconnect Exits from FTP.
get Grabs file from the computer to which you are connected.
glob Sets globbing on or off. When turned off the file name in the put and get commands is taken literally and wildcards are not used.
hash Sets hash mark printing on or off. When turned on, for each 1024 bytes of data received, a hash mark (#) is displayed.
help Access the help screen and displays information about command if command typed after help.
lcd Displays local directory if typed alone, or if path typed after lcd, changes local directory.
literal Sends a literal command to the connected computer with an expected one line response.
ls Lists files of the remotely connected computer.
mdelete Multiple delete.
mdir Lists contents of multiple remote directories.
mget Get multiple files.
mkdir Make directory.
mls Lists contents of multiple remote directories.
mput Sent multiple files
open Opens address.
prompt Enables or disables the prompt.
put Send one file.
pwd Print working directory.
quit Exits from FTP.
quote Same as the literal command.
recv Receive file.
remotehelp Get help from remote server.
rename Renames a file.
rmdir Removes a directory on the remote computer.
send Send single file.
status Shows status of currently enabled and disabled options.
trace Toggles packet tracing.
Type Set file transfer type.
user Send new user information.
verbose Sets verbose on or off.

查看英文版

查看中文版

ftp 示例

使用FTP连接

要在MS-DOS提示符,命令行或Linux shell上使用FTP连接到另一台计算机,请键入FTP,然后按Enter。进入FTP后,使用open命令连接到FTP服务器,如以下示例所示。

open ftp.example.com

在上面的示例中,您将example.com替换您连接的域名或IP地址。例如:打开192.168.1.12。

连接后,将出现用户名和密码提示。输入这些凭据后,服务器将允许您根据您的权限浏览,发送或接收文件。某些服务器还可能允许使用来宾或电子邮件地址进行匿名登录。

在FTP中发送和接收文件

要将文件从服务器获取到计算机上,请使用get命令,如以下示例所示。在此示例中,您将获得文件myfile.htm。

get myfile.htm

Use the send command, as shown in the following example, to move a file to another computer to which you are connected. In this example, we are sending the myfile.htm to the current directory. 如下例所示,使用send命令将文件移动到您连接的另一台计算机上。在此示例中,我们将myfile.htm发送到当前目录。

send myfile.htm

重要的是要意识到要发送的文件必须在本地工作目录中。换句话说,就是您键入FTP命令时所在的目录。如果要更改到包含文件的目录,请使用lcd命令。例如,在Windows中,您将键入lcd c:\ windows以将本地目录设置为Windows目录。

Connect using FTP

To connect to another computer using FTP at the MS-DOS prompt, command line, or Linux shell, type FTP, and press Enter. Once in FTP, use the open command to connect to the FTP server, as shown in the following example.

open ftp.example.com

In the example above, you'd substitute example.com for the domain name or IP address of where you are connecting. An example would be open 192.168.1.12.

Send and receive a file in FTP

To get files from the server onto your computer, use the get command, as shown in the following example. In this example, you would get the file myfile.htm.

get myfile.htm
Use the send command, as shown in the following example, to move a file to another computer to which you are connected. In this example, we are sending the myfile.htm to the current directory.
send myfile.htm

It is important to realize that the files being sent must be in your local working directory. In other words, the directory you were in when you typed the FTP command. If you want to change to the directory that contains your files, use the lcd command. For example, in Windows, you'd type lcd c:\windows to set the local directory to the Windows directory.

默认情况下,open命令使用TCP端口21建立FTP连接。如果需要使用其他TCP端口进行连接,请在open命令中的域名或IP地址后面输入端口号。如果希望获取多个文件,请使用mget和通配符。 例如,如果希望获得所有以.htm结尾的文件,可以输入mget *.htm。 最后,如果您不想在发送每个文件时被提示,请确保键入prompt来禁用提示。

By default, the open command uses the TCP port 21 to make the FTP connection. If a different TCP port is needed to connect, enter the port number after the domain name or IP address in the open command.If you want to get more than one file, use mget and wildcards. For example, if you wanted to get all files that end with .htm, you could type mget *.htm. Finally, if you do not want to be prompted as each file is being sent, make sure to type prompt to disable prompting.

查看英文版

查看中文版