Forrest logo
back to the scp tool

scp:tldr:16187

scp: Recursively copy the contents of a directory from a remote host to a local directory.
$ scp -r ${remote_host}:${path-to-remote_directory} ${path-to-local_directory}
try on your machine

The command scp -r ${remote_host}:${path-to-remote_directory} ${path-to-local_directory} is used to copy files and directories from a remote server to a local machine using SCP (Secure Copy Protocol).

Here's a breakdown of the command:

  • scp: The command-line tool used for secure file transfer between a local and remote system.

  • -r: This option stands for "recursive" and is used when you want to copy directories and their contents.

  • ${remote_host}: The hostname or IP address of the remote server. You need to replace ${remote_host} with the actual address.

  • :${path-to-remote_directory}: The path to the remote directory you want to copy. You need to replace ${path-to-remote_directory} with the actual path.

  • ${path-to-local_directory}: The path to the local directory where you want to save the copied files. You need to replace ${path-to-local_directory} with the actual path.

By running this command, you will establish a secure connection to the remote server (${remote_host}), authenticate yourself, and copy the contents of the specified remote directory (${path-to-remote_directory}) to the specified local directory (${path-to-local_directory}).

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