Linux 命令 - ftp: 网络文件传输工具

命令格式

ftp [-pinegvd] [host]

 

命令参数

-A
  传输文件模式为主动模式。

-p
  传输文件模式为被动模式。

-i
  关闭交互模式。

-n
  关闭自动登录功能。

-e
  不记录历史命令。

-g
  禁用文件名替换

-v
  命令执行时显示详细的处理信息。

-d
  启用调试。

 

FTP 内部命令

命令说明
 ascii 使用 ASCII 传输方式。
 bell 每个命令执行完后响铃一次。
 bin 使用二进制传输方式。
 bye 结束 ftp 会话并退出程序。
 cd remote-directory  进入指定的远程目录。
 cdup 进入远程系统的父目录。
 chmod mode file-name  更改远程文件的权限模式。
 close 中断与远程服务器的 ftp 会话(与 open 相对应)。
 delete remote-file 删除远程系统的文件。
 debug 切换调试模式。
 dir [remote-directory] [local-file]  列出远程目录 remote-directory 的内容,并将结果保存至本地文件 local-file。 
 disconnection 同 close。
 get remote-file [local-file] 将远程目录的文件下载至本地目录。
 help [command] 显示内部命令的帮助信息。
 lcd 切换本地系统的工作目录。
 ls 列出远程系统上的目录列表。
 mkdir directory-name 在远程主机上创建一个目录。
 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。
 size file-name 显示远程文件的大小。
 status 显示当前 ftp 状态。
 system 显示远程主机的操作系统类型。
 umask [newmask] 设置远程系统的文件模式掩码值。
 user user-name [password] [account]  向远程主机表明自己的身份。

 

实例

a) 从 FTP 服务器 192.168.1.88 上的 /ggd/commons-jxpath-1.3.jar 目录中下载 文件至本地目录 ~/cmdline。

[huey@huey-K42JE ~]$ ftp 192.168.1.88
Connected to 192.168.1.88 (192.168.1.88).
220 (vsFTPd 2.2.2)
Name (192.168.1.88:huey): sugar
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (10,1,231,4,178,241).
150 Here comes the directory listing.
drwxr-xr-x    2 505      501          4096 Aug 31 02:29 ggd
drwxr-xr-x    2 505      501          4096 Sep 02 03:22 ttd
226 Directory send OK.
ftp> cd ggd
250 Directory successfully changed.
ftp> ls
227 Entering Passive Mode (10,1,231,4,184,4).
150 Here comes the directory listing.
-rw-r--r--    1 505      501       2738534 Oct 14 09:10 commons-jxpath-1.3.jar
-rw-r--r--    1 505      501       1681848 Oct 14 09:10 commons-jxpath-1.3-javadoc.jar
-rw-r--r--    1 505      501       7403118 Oct 14 09:10 commons-jxpath-1.3-sources.jar
226 Directory send OK.
ftp> lcd ~/cmdline/
Local directory now /home/huey/cmdline
ftp> get commons-jxpath-1.3.jar
local: commons-jxpath-1.3.jar remote: commons-jxpath-1.3.jar
227 Entering Passive Mode (10,1,231,4,92,222).
150 Opening BINARY mode data connection for commons-jxpath-1.3.jar (2738534 bytes).
226 Transfer complete.
2738534 bytes received in 0.0679 secs (40334.24 Kbytes/sec)
ftp> bye
221 Goodbye.

 

转载于:https://www.cnblogs.com/huey/p/4881225.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值