scp examples of transferring files

scp username@remotehost.com:/tmp/foo.txt /a/directory/path/
Copy the file foo.txt from the remotehost to your computer.

scp username@remotehost.com:/tmp/foo/\{foo.txt,bar.txt\} .
Copy the file foo.txt and bar.txt from remotehost to your current directory on your local computer.

scp -r username@remotehost.com:/tmp/foo/ .
Copy the directory foo/ from remotehost to your current directory on your local computer.

scp /a/directory/path/foo.txt username@remotehost.com:/tmp/
Upload the file foo.txt from your computer to the remotehost.

scp foo.txt bar.txt username@remotehost.com:~
Upload two files to your home directory on the remotehost.

scp -r /a/directory/path/foo/ username@remotehost.com:/tmp/
Upload the directory foo from your computer to the remotehost’s tmp directory.

scp -P 1234 foo.txt username@remotehost.edu:/tmp/
Upload the foo.txt from your computer to the remotehost using the port number 1234.

scp username@remotehost1.com:/tmp/foo.txt username@remotehost2.com:/tmp/
Copy the foo.txt from remotehost1 to remotehost2

Search within Codexpedia

Custom Search

Search the entire web

Custom Search