This guide explains you about how to copy a file from the remote machine to our local host using scp command. ” scp ” is similar to copy command in GNU/Linux. It is mainly used to copy the files in the internet/intranet remote machine.
Syntax : scp source destination
For the remote file you need to add username@<remote_machine_ip_address>:<absolute_path_of_the_file>
Note : You can also use a Fully Qualified Domain Name (FQDN) instead of ip address.
For example I want to copy a file ” sample.txt ” from the remote host to my localhost, the command should be like this
scp firstname.lastname@example.org:/home/testuser/Documents/sample.txt /root/Documents
Here scp is the command name used to copy the file
email@example.com:/home/testuser/Documents/sample.txt is the full path of the sample.txt file
/root/Documents is the destination path to save the copied file.