您的位置:首页 > 运维架构 > Linux

在DOS和LINUX下的FTP命令

2016-06-29 21:25 465 查看

1 FTP命令

1.1 DOS下的FTP命令

1.1.1 FTP命令选项

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

FTP [-v] [-d] [-i] [-n] [-g] [-s:filename][-a] [-A] [-x:sendbuffer] [-r:recvbuffer] [-b:asyncbuffers] [-w:windowsize] [host]

-v 禁止显示远程服务器响应。
-n 禁止在初始连接时自动登录。
-i 关闭多文件传输过程中的
交互式提示。
-d 启用调试。
-g 禁用文件名通配(请参阅 GLOB 命令)。
-s:filename 指定包含 FTP 命令的文本文件;命令
在 FTP 启动后自动运行。
-a 在绑字数据连接时使用所有本地接口。
-A 匿名登录。
-x:send sockbuf 覆盖默认的 SO_SNDBUF 大小 8192。
-r:recv sockbuf 覆盖默认的 SO_RCVBUF 大小 8192。
-b:async count 覆盖默认的异步计数 3
-w:windowsize 覆盖默认的传输缓冲区大小65535。
host 指定主机名称或要连接到的远程主机
的 IP 地址。

注意:
-mget 和 mput 命令将 y/n/q 视为 yes/no/quit。
- 使用 Ctrl-C 中止命令。

1.1.2 FTP中的命令

FTP命令详解

ascii: 设定以ASCII方式传送文件(缺省值)

bell: 每完成一次文件传送,报警提示.

binary:设定以二进制方式传送文件.

bye: 终止主机FTP进程,并退出FTP管理方式.

case: 当为ON时,用MGET命令拷贝的文件名到本地机器中,全部转换为小写字母.

cd: 同UNIX的CD命令.

cdup: 返回上一级目录.

chmod: 改变远端主机的文件权限.

close: 终止远端的FTP进程,返回到FTP命令状态,所有的宏定义都被删除.

delete: 删除远端主机中的文件.

dir [remote-directory] [local-file]
列出当前远端主机目录中的文件.如果有本地文件,就将结果写至本地文件.

get [remote-file] [local-file]
从远端主机中传送至本地主机中.

help [command]
输出命令的解释. (即客户端的命令集合)

lcd: 改变当前本地主机的工作目录,如果缺省,就转到当前用户的HOME目录.

ls [remote-directory] [local-file]
同DIR.

macdef: 定义宏命令.

mdelete [remote-files]
删除一批文件.

mget [remote-files]
从远端主机接收一批文件至本地主机.

mkdir directory-name
在远端主机中建立目录.

mput local-files
将本地主机中一批文件传送至远端主机.
如果想不每次输入Yes,可以用 prompt 命令关掉交互模式

open host [port]
重新建立一个新的连接.

prompt:交互提示模式.

put local-file [remote-file]
将本地一个文件传送至远端主机中.

pwd: 列出当前远端主机目录.

quit: 同BYE.

recv remote-file [local-file]
同GET.

rename [from] [to]
改变远端主机中的文件名.

rmdir directory-name
删除远端主机中的目录.

send local-file [remote-file]
同PUT.

status: 显示当前FTP的状态.

system: 显示远端主机系统类型.

user user-name [password] [account]
重新以别的用户名登录远端主机.

在用windows登录liunx的ftp服务的时候会看到ftp的版本,由此可以在linux中进入/etc查找相应版本的
ftp服务端程序,其中会有一个ftp的配置,配置各种规则,如上传文件是否能覆盖已有文件。

1.1.3 命令范本

ftp -i -s:c:\ftp.conf
ftp.conf文件
open 192.168.1.2
username
passwd
prompt
bin
lcd c:\
cd /home/oracle
mget *.dmp
bye


1.2 linux下的FTP命令

1.2.1 FTP命令选项

-v Verbose option forces ftp to show all responses from the remote server,as well as report on data transfer statistics.
-n Restrains ftp from attempting ‘‘auto-login’’ upon initialconnection. If auto-login is enabled, ftpwill check the .netrc (see below) file in the user’s home directory foran entry describing an account on the remote machine. If no entry exists, ftp will prompt for the remotemachine login name (default is the user identity on the local machine), and, ifnecessary, prompt for a password and an account with which to login.
-u Restrains ftp from attempting ‘‘auto-authentication’’ upon initial connection. Ifauto-authentication is enabled, ftp attempts to authenticate to the FTP serverby sending the AUTH command, using whichever authentication types are locallysupported. Once an authen-tication typeis accepted, an authentication protocol will proceed by issuing ADATcommands. This option also disablesauto-login.
-i Turns off interactive prompting during multiple file transfers.
-d Enables debugging.
-g Disables file nameglobbing.
-k realm
When using Kerberos v4authentication, gets tickets in realm.
-f Causes credentials to beforwarded to the remote host.
-x Causes the client to attempt to negotiate encryption (data andcommand protection levels ‘‘private’’) immediately after successfully
authenticating.
-t Enables packet tracing.
对于选项这块和DOS下的FTP还是有一定的区别的,例如没有-S选项;FTP命令就不做过多说明,和DOS下区别不大。

1.2.2 命令范本

ftp –n -v -i 34.97.34.3 << !
user ftpuser ftpuser
bin
mput $YESTERDAY.*
delete $THREEDAYAGO.*
bye
!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux dos ftp