How to use scp command to transfer files

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 root@ /root/Documents

Here scp is the command name used to copy the file

 root@ is the full path of the sample.txt file

/root/Documents is the destination path to save the copied file.

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)

Add a Comment

Your email address will not be published. Required fields are marked *