scp – a Great Command to Know

As long as you have TCP port 22 (default SSH port) open between two hosts, a great and efficient way to copy files is using the scp command.

Usage

scp [[user@]from-host:]source-file [[user@]to-host:][destination-file]

Options

-p
Preserves the modification and access times, as well as the permissions of the source-file in the destination-file
-q
Do not display the progress bar
-r
Recursive, so it copies the contents of the source-file (directory in this case) recursively
-v
Displays debugging messages
Examples

scp -r * user@host:/var/www/app/files/priv/

This will copy all files from the current directory on the current host to the /var/www/app/files/priv directory on the remote host

Facebook Comments

Dan Schneck is an experienced technology entrepreneur who enjoys working with and learning from passionate and driven people. He enjoys family time, jazz music, hockey, and sharing & discussing ideas and education.

Connect up and follow me on Twitter or Instagram