Linux Commands(I) scp

Linux Commands(I) scp

1. scp is Secure Copy.

Copy the file from a remote host to the local host
>scp [email protected]:/home/luohua/server.txt /home/luohua/tmp/server.txt

Copy the directory "client" from the local host to a remote host's directory "server"
>scp -r client [email protected]:/home/luohua/server

Some other examples
Copy the file "foobar.txt" from remote host "rh1.edu" to remote host "rh2.edu"
>scp [email protected]:/some/remote/directory/foobar.txt [email protected]:/some/remote/directory/

Copying the files "foo.txt" and "bar.txt" from the local host to your home directory on the remote host
>scp foo.txt bar.txt [email protected]:~

Copy multiple files from the remote host to your current directory on the local host
>scp [email protected]:/some/remote/directory/\{a,b,c\} .
>scp [email protected]:~/\{foo.txt,bar.txt\} .

2. Test to run them in shell script
>vi data_import.sh
#!/bin/sh

echo "step1 start.................."
scp [email protected]:~/server.txt ./t1.txt
echo "step1 end...................."

echo "step2 start.................."
wget http://www.baidu.com
echo "step2 end...................."

references:
http://www.hypexr.org/linux_scp_help.php
http://www.computerhope.com/unix/wget.htm





猜你喜欢

转载自sillycat.iteye.com/blog/1100359