scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port] [-S program] [[[email protected]]host1:]file1 ... [[[email protected]]host2:]file2
DESCRIPTION :scp copies files between hosts on a network.
DESCRIPTION :scp copies files between hosts on a network.
利用scp传输文件
1、从服务器下载文件scp [email protected]:/path/filename /tmp/local_destination
例如scp [email protected]:/home/kimi/test.txt 把192.168.0.101上的/home/kimi/test.txt
的文件下载到 /tmp/local_destination
2、上传本地文件到服务器
scp /path/local_filename [email protected]:/path
例如scp /var/www/test.php [email protected]:/var/www/ 把本机/var/www/目录下的test.php文件
上传到192.168.0.101这台服务器上的/var/www/目录中
3、从服务器下载整个目录
scp -r [email protected]:remote_dir/ /tmp/local_dir
例如:scp -r [email protected] /home/kimi/test /tmp/local_dir
4、上传目录到服务器
scp -r /tmp/local_dir [email protected]:remote_dir
例如:
scp -P 22 -r test [email protected]:/var/www/ 把当前目录下的test目录上传到服务器
的/var/www/ 目录
refer:http://blog.csdn.net/ssihc0/article/details/7544573 edit a little bit