How to Copying Remote Files with scp

Valic —  October 10, 2010 — Leave a comment

Here are some examples of useful scp commands:

$ scp file1 [email protected]:/tmp/

Password: ******
Above code copies file1 to server1.

$ scp server1:/tmp/file1

Password: ******
Copy remote file1 to local working directory. Use the -p option to preserve permissions and timestamps on the copied files.

$ scp -p file1 server1:/tmp/If the SSH service is configured to listen on a port other than the default port 22, use -P to indicate that port on the scp command line:

$ scp -P 12345 file1 server1:/tmp/

Connect to a particular port.To do recursive copies, from a particular point in the remote file system, use the -r option:

$ scp -r dir1 [email protected]:/tmp/

Copies all dir1 to remote /tmp .
I hope I was helpful.

Valic

Posts Twitter Facebook

Editor in Chief at Debian-Tutorials, Linux enthusiast.

No Comments

Be the first to start the conversation.

Leave a Reply