ftp命令用法

一、 ftp命令

1.登录:ftp 192.168.xx.xx 回车后输入用户名和密码
或者 直接输入ftp 回车 再输入open 192.168.XX.XX
2.常用命令:ls和dir 显示文件列表
cd 目录 和cd … 切换ftp服务器路径
lcd 切换本地目录
put和get 上传、下载文件
send 上传文件
mget 下载多个文件
rename filename 重命名ftp服务器文件
delete filename 删除服务器文件
pwd 查看服务器路径
close 结束会话
quit 结束会话并退出ftp
3. 传输编码:
FTP的传输类型分为ASCII码方式和二进制方式两种,对.txt、.htm等文件应采用ASCII码方式传输,对.exe或图片、视频、音频等文件应采用二进制方式传输。在默认情况下,FTP为ASCII码传输方式。
type:查看当前的传输方式
ascii:设定传输方式为ASCII码方式
binary:设定传输方式为二进制方式

4.脚本写法:
ftp -v -n 192.168.XX.XX port <<EOF
user username password
binary
cd xx
lcd xx
prompt
mget *
cd …
cd xx
put test.txt
close
bye
EOF

二、sftp命令

sftp> help
Available commands:
bye Quit sftp
cd path Change remote directory to ‘path’
chgrp grp path Change group of file ‘path’ to ‘grp’
chmod mode path Change permissions of file ‘path’ to ‘mode’
chown own path Change owner of file ‘path’ to ‘own’
df [-hi] [path] Display statistics for current directory or
filesystem containing ‘path’
exit Quit sftp
get [-afPpRr] remote [local] Download file
reget [-fPpRr] remote [local] Resume download file
reput [-fPpRr] [local] remote Resume upload file
help Display this help text
lcd path Change local directory to ‘path’
lls [ls-options [path]] Display local directory listing
lmkdir path Create local directory
ln [-s] oldpath newpath Link remote file (-s for symlink)
lpwd Print local working directory
ls [-1afhlnrSt] [path] Display remote directory listing
lumask umask Set local umask to ‘umask’
mkdir path Create remote directory
progress Toggle display of progress meter
put [-afPpRr] local [remote] Upload file
pwd Display remote working directory
quit Quit sftp
rename oldpath newpath Rename remote file
rm path Delete remote file
rmdir path Remove remote directory
symlink oldpath newpath Symlink remote file
version Show SFTP version
!command Execute ‘command’ in local shell
! Escape to local shell

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值