The tool uses an ssh connection in the background to perform the file transfer.
Basic syntax:
scp source_file_path destination_file_path
If you want to transfer(or "upload") a file from your local machine to a remote machine the command would be:
scp ~/a_local_file.txt user@remote_host.com:/some_remote_directory
If you want to transfer files from a remote host to the local host home directory:
scp user@remote_host.com:/some_remote_directory/a_remote_file.txt .
Is the remote ssh server listening to a specified port other than 22, the port must
be specified via the -P flag.
My raspberry pi's ssh-server listens to port 3878, and has ip-address 192.168.1.6
Hence the command for transferring a file from the raspberry to my local machine would be:
scp -P 3878 pi@192.168.1.6:/home/pi/some_file.txt .