Ubuntu 服务器上传和下载文件

April 10, 2018 · 48 words · One minute

Ubuntu 服务器上传和下载文件

使用 scp 命令完成文件的上传和下载

上传

  • 上传单个文件
scp -p port source_dictionary_file user@ServerIp:target_dictionary_file

prot 默认是22,如果使用默认可以不写

scp /User/hellowood/wechat.jpg [email protected]:/home/hellowood/wechat.jpg
  • 上传整个文件夹
scp -p port -r source_dictionary user@ServerIp:target_dictionary
scp -r /User/hellowood/tomcat [email protected]:/home/hellowood/tomcat

下载

  • 下载单个文件
scp -p user@ServerIp:source_dictionary_file target_dictionary
scp [email protected]:/home/hellowood/wechat.jpg /User/hellowood/wechat.jpg
  • 下载文件夹
scp -p port -r user@ServerIp:source_dictionary target_dictionry
scp -r [email protected]:/home/hellowood/tomcat /User/hellowood/tomcat