利用scp傳輸文件
1、從服務器下載文件
scp username@servername:/path/filename ./
例如scp root@*****:/home/kimi/test.txt 把*****服務器地址上的/home/kimi/test.txt
的文件下載到 ./
2、上傳本地文件到服務器
scp /path/local_filename username@servername:/path
例如scp /var/www/test.php [email protected]:/var/www/ 把本機/var/www/目錄下的test.php文件
上傳到192.168.0.101這臺服務器上的/var/www/目錄中
3、從服務器下載整個目錄
scp -r username@servername:remote_dir/ /tmp/local_dir
例如:scp -r [email protected]:/home/kimi/test /tmp/local_dir
4、上傳目錄到服務器
scp -r /tmp/local_dir username@servername:remote_dir
例如:
scp -r test [email protected]:/var/www/ 把當前目錄下的test目錄上傳到服務器的/var/www/ 目錄
refer:http://blog.csdn.net/ssihc0/article/details/7544573 edit a little bit