免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3095 | 回复: 0
打印 上一主题 下一主题

远程传送文件命令大全(ssh ftp) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-01-18 08:21 |只看该作者 |倒序浏览
ftp:     
  ftp ip
  > get filename
  > put  filename
  > bye
ssh:
传输到远程:tar czf - /path/filename | ssh server "tar zxf -"  
这样回把文件传送到登陆server上用户的根目录里。
SSH PUSH(从本地发送到远程):
代码:
$ tar cvf - . | gzip -c -1 | ssh
[email=user@host]user@host[/email]
"cat > remotefile.gz"
$ tar czvf - . | ssh
[email=user@host]user@host[/email]
"cat > remote.tar.gz"
$ ssh target_address cat " remotefile
$ ssh target_address cat " remotefile
$ cat localfile | ssh target_address cat ">" remotefile
$ cat localfile | ssh target_address cat - ">" remotefile
注: 以上命令行中的 大于号> 两边有双引号(" ") , 小于号
$ dd if=localfile | ssh target_address dd ōf=remotefile
$ ssh target_address cat  remotefile.tar )"
$ ( cd SOURCEDIR && tar czvf - . ) | ssh target_address "(cd DESTDIR && cat - > remotefile.tgz )"
$ ( cd SOURCEDIR && tar cvf - . | gzip -1 -) | ssh target_address "(cd DESTDIR && cat - > remotefile.tgz )"
$ ssh target_address "( nc -l -p 9210 > remotefile & )" && cat source-file | gzip -1 - | nc target_address 9210
$ cat localfile | gzip -1 - | ssh target_address cat ">" remotefile.gz
SSH PULL(从远程获取到本地):
代码:
$ ssh target_address cat remotefile > localfile
$ ssh target_address dd if=remotefile | dd ōf=localfile
$ ssh target_address cat " localfile
$ ssh target_address cat "localfile
SSH COMPARE(本地和远程文件比较):
代码:
用远程计算机CPU执行比较指令
$ ssh target_address cat remotefile | diff - localfile
$ cat localfile | ssh target_address diff - remotefile
用本地计算机CPU执行比较指令
$ ssh target_address cat
注:
1、把文件压缩后再传送速度一般要比直接传送更快。
2、以上命令行中 'localfile' 和 ' remotefile' 可以是文件、目录、镜像、硬盘分区、或者硬盘驱动器( files, directories, images, hard drive partitions, or hard drives)。
FTP VIEW(从本地查看远程文件):
代码:
$ ftp> get file.gif "| xv -"
$ ftp> get README "| more"
FTP PUSH(从本地发送到远程):
代码:
$ ftp> put "| tar cvf - ." myfile.tar
$ ftp> put "| tar cvf - . | gzip " myfile.tar.gz
FTP PULL(从远程获取到本地):
代码:
$ ftp> get myfile.tar "| tar xvf -"

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/91453/showart_2151632.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP