使用scp命令,远程上传下载文件/文件夹

一、从服务器下载文件

scp username@servername:/path/filename /local/path
例如: scp ubuntu@117.50.20.56:/ygf/data/data.txt /desktop/ygf   把117.50.20.56上的/ygf/data/data.txt 的文件下载到/desktop/ygf目录中ubuntu

 

二、上传本地文件到服务器

scp /local/path/local_filename username@servername:/path
例如: scp /ygf/learning/deeplearning.doc  ubuntu@117.50.20.56:/ygf/learning    把本机/ygf/learning/目录下的deeplearning.doc文件上传到117.50.20.56这台服务器上的/ygf/learning目录中服务器

 

三、从服务器下载整个目录

scp -r username@servername:/path /path
例如: scp  -r  ubuntu@117.50.20.56:/home/ygf/data  /local/local_dir    “-r”命令是文件夹目录,把当前/home/ygf/data目录下全部文件下载到本地/local/local_dir目录中

spa

四、上传目录到服务器

scp  -r  /path  username@servername:/path
例如: scp -r  /ygf/test  ubuntu@117.50.20.56:/ygf/tx     “-r”命令是文件夹目录,把当前/ygf/test目录下全部文件上传到服务器的/ygf/tx/目录中server

相关文章
相关标签/搜索