• 用 scp 命令通过 SSH 互传文件


    上传单个文件到远程服务器

    命令格式

    scp [/path/local_dir/filename] [username@servername:/path/remote_dir]
    

    上传本地的 vimrc 文件到远程服务器

    15:10 luna@linux-suse /home/luna
    $ scp /home/luna/scp/vimrc luna@192.168.0.108:/usr/home/luna/.vimrc
    Password for luna@FreeBSD:
    vimrc 100% 8090 7.9KB/s 00:00
    

      

    上传文件夹到远程服务器

    命令格式

    scp -r [/path/local_dir] [username@servername:/path/remote_dir]

    上传当前目录下的 tools 文件夹到远程服务器

    15:35 luna@linux-suse /home/luna/scp
    $ scp -r tools luna@192.168.0.108:/usr/home/luna
    Password for luna@FreeBSD:
    test1.sh 100% 152 0.2KB/s 00:00 
    test3.sh 100% 165 0.2KB/s 00:00 
    test4.sh 100% 131 0.1KB/s 00:00 
    test2.sh 100% 120 0.1KB/s 00:00
    

      

    从远程服务器下载单个文件

    命令格式

    scp [username@servername:/path/remote_dir/filename] [/path/local_dir]
    

    从远程服务器下载一个 Python3 源码压缩包

    18:10 luna@linux-suse /home/luna/scp
    $ scp luna@192.168.0.108:/usr/home/luna/Python-3.6.2.tar.xz ~/scp/test 
    Password for luna@FreeBSD:
    Python-3.6.2.tar.xz 100% 16MB 8.1MB/s 00:02
    

      

    从远程服务器下载文件夹

    命令格式

    scp -r [username@servername:/path/remote_dir/] [/path/local_dir] 

    下载远程服务器上的 install 文件夹

    18:30 luna@linux-suse /home/luna/scp
    $ scp -r luna@192.168.0.108:/usr/home/luna/install ~/scp/test 
    Password for luna@FreeBSD:
    portage-latest.tar.xz 100% 62MB 8.9MB/s 00:07 
    install-amd64-minimal-20170727.iso 100% 268MB 10.3MB/s 00:26
    

      

  • 相关阅读:
    自己定义button
    Google C++ style guide——格式
    杭电1018-Big Number(大数)
    AnyForWeb告诉你什么才是“最好的”编程语言
    Android广播机制分析
    nyoj Wythoff Game(暴力枚举)
    基础搜索入门(二)
    1.1、Libgdx目标和特性
    我在农业2.0的互联网创业思考 (1)
    Python演绎的精彩故事(二)
  • 原文地址:https://www.cnblogs.com/tsdxdx/p/7287130.html
Copyright © 2020-2023  润新知