使用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

相關文章
相關標籤/搜索