Friday, June 28, 2013

Using scp

The slow way

# -- Execute on local computer
# Copy hello.txt from local computer to remote home directory
$ scp -i skey.pem hello.txt ubuntu@ec2-54-218-73-84.us-west-2.compute.amazonaws.com:~/
# Copy hello.txt from local to remote home directory, renaming it foo.txt
$ scp -i skey.pem hello.txt ubuntu@ec2-54-218-73-84.us-west-2.compute.amazonaws.com:~/foo.txt
# Copying ~/foo.txt from remote to current local directory
$ scp -i skey.pem ubuntu@ec2-54-218-73-84.us-west-2.compute.amazonaws.com:~/foo.txt .
# Copying ~/foo.txt from remote to local directory cc, renaming it a.b
$ scp -i skey.pem ubuntu@ec2-54-218-73-84.us-west-2.compute.amazonaws.com:~/foo.txt cc/a.b

The fast way

First, setup the ~/.ssh/config file.

# -- Execute on local computer
# Copy hello.txt from local computer to remote home directory
$ scp hello.txt awshost1:~/

# Copy hello.txt from local to remote home directory, renaming it foo.txt
$ scp hello.txt awshost1:~/foo.txt

No comments:

Post a Comment