Menu Close

How to move files around with scp

Secure Copy (scp) is an easy and powerful tool to use over SSH channel.

Download a remote file

scp -i conn.pem azureuser@ip:/home/azureuser/output.gz output.gz

Upload a file to remote

scp output.gz -i conn.pem azureuser@ip:/home/azureuser/output.gz

as you can see from above command, the order of the file determines upload or download.

Additionally, you can use following options to achieve more.

-C – to compresses the file or directory during the copying process.

-P – to specify the SSH port if the default SSH port is not set to 22.

-r – to recursively copies a directory alongside its contents.

p – to preserves the access and modification times of the file being copied.

Leave a Reply

Your email address will not be published. Required fields are marked *