1.用ssh登錄遠程ubuntu主機
(主機ip爲:1.2.3.4;用戶名:username)
ssh [email protected]
2.從遠程ubuntu主機copy文件/文件夾到本地(scp)
(遠程文件夾位置:/home/username/test.txt;本地保存目錄爲: .(當前目錄))
scp username@servername:/path/filename /var/www/local_dir(本地目錄)
3.從本地向遠程ubuntu主機copy文件/文件夾(scp)
scp /path/filename username@servername:/path/
4.從服務器下載整個目錄
scp -r username@servername:/var/www/remote_dir/(遠程目錄) /var/www/local_dir(本地目錄)
5.上傳目錄到服務器
scp -r local_dir username@servername:remote_dir