我不确定是否可能 scp
从远程到本地的文件夹,但我仍然没有其他选项。我使用ssh登录我的服务器,然后从那里我想复制该文件夹 foo
至 home/user/Desktop
(我的当地人)。有没有命令让我可以这样做?
我不确定是否可能 scp
从远程到本地的文件夹,但我仍然没有其他选项。我使用ssh登录我的服务器,然后从那里我想复制该文件夹 foo
至 home/user/Desktop
(我的当地人)。有没有命令让我可以这样做?
scp -r user@your.server.example.com:/path/to/foo /home/user/Desktop/
从 man scp
-r Recursively copy entire directories
使用全功率 SCP 你需要经历下一步:
然后,例如,如果你有这个 的〜/ .ssh /配置:
Host test
User testuser
HostName test-site.com
Port 22022
Host prod
User produser
HostName production-site.com
Port 22022
你将节省密码输入和简化 SCP 像这样的语法:
scp -r prod:/path/foo /home/user/Desktop # copy to local
scp -r prod:/path/foo test:/tmp # copy from remote prod to remote test
更重要的是,您将能够使用远程路径完成:
scp test:/var/log/ # press tab twice
Display all 151 possibilities? (y or n)
更新:
要启用远程bash-completion,您需要在两者上都有bash-shell <source>
和 <target>
主机,并正确地工作bash完成。有关更多信息,请参阅相关问题
复制全部 本地位置 至 偏远的地点 (上传)
scp -r /path/from/destination username@hostname:/path/to/destination
复制全部 偏远的地点 至 本地位置 (下载)
scp -r username@hostname:/path/from/destination /path/to/destination
定制端口在哪里 xxxx
是 自定义端口 数
scp -r -P xxxx username@hostname:/path/from/destination /path/to/destination
从当前目录复制 远程到本地
scp -r username@hostname:/path/from/file .
帮帮我:
-r
递归复制所有目录和文件/
,获取完整的位置 pwd
scp
将替换所有现有文件hostname
将是主机名或IP地址-P portnumber
注意: 有时由于防火墙中不允许端口,自定义端口将无法工作,因此请确保防火墙中允许自定义端口进行传入和传出连接
我一直用的是:
scp -r username@IP:/path/to/server/source/folder/ .
。 (点) : 它的意思是 current folder
。所以从服务器复制并粘贴到此处。
IP :可以是一个IP地址 125.55.41.311
或者它可以像主机一样 ns1.mysite.com
。
最好先在远程服务器上压缩目录:
tar czfP backup.tar.gz /path/to/catalog
其次,从远程下载:
scp user@your.server.example.com:/path/to/backup.tar.gz .
最后,解压缩文件:
tar -xzvf backup.tar.gz
如果您有一个可以从远程位置下载的文件,如果您不太关心安全性,请尝试将scp默认加密(Triple-DES)更改为“blowfish”。
这将大大减少文件复制时间。
scp -c blowfish -r user@your.server.example.com:/path/to/foo /home/user/Desktop/
转到统一工具栏上的文件
按Ctrl + l并写入here_goes_your_user_name@192.168.10.123
192.168.1.103是您要连接的主机。
这里有一个例子