scp command

240 阅读1分钟

Basic syntax of SCP

scp source_file_name username@destination_host:destination_folder

scp -p gitlab-ce-10.2.3-ce.0.el7.x86_64.rpm root@172.31.x.x:.

  1. Limit the bandwidth usage

If you do not want scp to take up the entire available bandwidth, then use the l option to limit the maximum speed in Kbit/s.

scp -vrC -l 400 ~/Downloads root@192.168.1.3:/root/Downloads

  1. Connect to a different port number on remote host

If the remote server has ssh daemon running on a different port (default is 22), then you need to tell scp to use that particular port number using the '-P' option.

$ scp -vC -P 2200 ~/test.txt root@192.168.1.3:/some/path/test.txt

  1. Transfer multiple files

Multiple files can be specified separated by a space like this

$ scp foo.txt bar.txt username@remotehost:/path/directory/