scp copy file from remote to local code example
Example 1: scp send file
scp ./file.txt remote_username@remote_ip:/remote/directory
Example 2: bash How To Transfer Files From a Remote Server to another Remote Server
# Basic syntax:
scp source destination
# Note, usually one or both of "source" and "destination" are remote
# (otherwise you'd just use cp for a local copy)
# To specify a local source or destination, just use the directory path
# To specify a remote destination, the format is:
# user@remote.server.com:/path/to/directory
# Example usage:
scp /Users/name/Downloads
Example 3: using scp
scp remote_username@10.10.0.2:/remote/file.txt /local/directory
Example 4: copy from remote to local
scp file.txt remote_username@10.10.0.2:/remote/directory
Example 5: scp local to remote
scp -i <private_key> ./file.txt remote_username@remote_ip:/remote/directory
Example 6: scp send file to remote
dragonmnl@local $ scp -P 2222 file.ext username@domain:~/