Forrest logo
back to the scp tool

scp:copy:local-to-remote

Copy a local file to a remote host.
$ scp ${path/to/local_file} ${remote_host}:${path/to/remote_file}
try on your machine

This command is used to copy a file from a local machine to a remote machine using the secure shell (SSH) protocol.

Here is a breakdown of the different parts of the command:

  • scp: This is the command used to copy files over SSH.
  • ${path/to/local_file}: This is the path to the file on the local machine that you want to copy. You need to replace this with the actual path to your file.
  • ${remote_host}: This is the name or IP address of the remote machine that you want to copy the file to. You need to replace this with the actual name or IP address.
  • ${path/to/remote_file}: This is the path to the file on the remote machine where you want to copy the file. You need to replace this with the actual path to your file.

For example, if you want to copy a file named example.txt located in the /home/user/Documents/ directory on your local machine to the remote machine with the IP address 192.168.0.1 and save it as example.txt in the /home/user/Documents/ directory, the command would look like this:

scp /home/user/Documents/example.txt 192.168.0.1:/home/user/Documents/example.txt

Note that you need to have SSH access and permission to copy files to the remote machine.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the scp tool