SCP is used to Securely CoPy files over the network.
The syntax for copying a file from a remote computer onto your machine is:
scp -r <username@ipaddress:/path_to_file_at_source_computer> <destination>
the -r can be omitted if you are not copying directories.
Here username is the name of a user a/c on the computers between which the data is being transferred
To copy a file or directory from your machine to another machine on a network is:
scp -r <destination> <username@ipaddress:/path_to_file_at_source_computer>
Note that the -r option is only needed if its a directory thats being copied.
An example, I want to copy /home/boss/docs from a computer on the network with IP address 192.168.1.101 onto my local machine(i.e., the machine iam using). I would use the following command:
scp -r firstname.lastname@example.org:/home/boss/docs .
Here boss is a user account on the computer I want to copy files from. On typing this command you’ll be prompted for the password to the account boss. Once thats done, you’ll see the files being copied from the source computer onto your current directory. The ‘.’ here us used to indicate the present working directory (pwd).You can replace it with any directory on your local computer that you can write into.