Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Scp From Remote To Local

February 23, 2022 by smail Baydan

The scp command is used to copy les and directories over the network in a secure way. As a command les can be copied via the command-line interface. The scp name
comes from Secure Copy . The scp command is provided by most of the Linux distributions can be used to copy from the remote server to the local system. The remote server
can be a Linux system or a Windows or just an SSH server with scp feature.

scp From Remote to Local Syntax


The scp command has the following syntax in order to copy les from remote to the local.

USER is the remote system user.


REMOTE is the remote system IP address or hostname.
REMOTE_PATH is the remote system le or directory location.
LOCAL_PATH is the local system path where the REMOTE_PATH  les or folders will be copied to.

Copy File From Remote To Local


In the following example, we copy a single le from the remote to the local. The remote system IP address is 192.168.1.10 and the remote le path is /home/ismail/db.txt.
The local path is /home/ahmet/db.txt.

Copy Multiple Files From Remote To Local


The scp command can be also used to copy multiple remote les to the local system. In the following example, we use the glob operator in order to select multiple  les for
the copy operation. We copy all *.txt les from remote to the local.

Copy Directory From Remote To Local Recursively


The scp command can be also used to copy remote directories to the local system. By default, the scp command copies only the specied directory and not its contents. But
recursive option -r can be used to copy remote system directories to the local in a recursive manner.

Specify Different Scp Port


The scp command and protocol is an extension to the SSH protocol and service. So scp command uses the SSH services for data transfer. The default SSH port number 22 is
used for transmission but we can change the port number. The -p option is used to specify the remote system port number.

You might also like