Sunday, August 14, 2016

SCP (Secure Copy) Examples

temp

SCP (Secure Copy) Examples

Copy the file "foo.txt" from a remote host to the local host

$ scp you@remotehost.edu:foo.txt /local/dir

Copy the file "foo.txt" from the local host to a remote host

$ scp foo.txt you@remotehost.edu:/remote/dir

Copy the directory "foo" from the local host to a remote host's directory "bar"

$ scp -r foo you@remotehost.edu:/remote/dir/bar

Copy the file "foo.txt" from remote host "rh1.edu" to remote host "rh2.edu"

$ scp you@rh1.edu:/remote/dir/foo.txt you@rh2.edu:/remote/dir/

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 you@remotehost.edu:~

Copy the file "foo.txt" from the local host to a remote host using port 2264

$ scp -P 2264 foo.txt you@remotehost.edu:/remote/dir

Copy multiple files from the remote host to your current directory on the local host

$ scp you@remotehost.edu:/remote/dir/\{a,b,c\} .
$ scp you@remotehost.edu:~/\{foo.txt,bar.txt\} .

No comments:

Post a Comment