On servers and even everyday work station computers, there are times when you need to securely copy over files to a desired host. That’s where SCP comes in, and it stands for Secure Copy. It is a encrypted end-to-end transfer of files. So let’s break down a simple scp example usage.

scp -P 777 /home/gary/images/image*.jpg gary@myhost.com:/home/gary/archive 
  • scp: This is the base command, without the rest of the required arguments involved.
  • -P 777: This specifies that we’d like to cary out our secure transfer specifically on port 777, and this flag is not required if not needed.
  • /home/gary/images/image*.jpg: This is our computer, using the path to our file we’d like to copy to the remote host.
  • gary@myhost.com:/home/gary/archive: The desination, which in our case is the remote host. You can also change the host and destination around to copy something from the remote host to your machine. It’s also important to note that you need to add the user you’re copying it to, with the specified ip address of that remote host, and it can be a domain like we see in this example.