将文件从远程主机复制到本地主机
Copy file from remote host to local host
我有以下用户名@机器连接
user1@machine1 -> user2@machine2
如何将文件从 machine2 复制到 machine1?
您可以使用scp
这样使用
scp <source path> <destination path>
远程文件地址为user_name@host_name:path/to/file
假设您要获取名为 a.txt
的文件,该文件位于机器 2 上用户 user2
的主目录中,例如 192.168.1.10
。您可以在您的机器上执行此操作1,
scp user2@192.168.1.10:a.txt .
您可以使用rsync
这样使用:
rsync -avz -e ssh remoteuser@remotehost:/remote/dir /this/dir/
Here is step by step tutorial. You can read about differences between rsync
and scp
here
我有以下用户名@机器连接
user1@machine1 -> user2@machine2
如何将文件从 machine2 复制到 machine1?
您可以使用scp
这样使用
scp <source path> <destination path>
远程文件地址为user_name@host_name:path/to/file
假设您要获取名为 a.txt
的文件,该文件位于机器 2 上用户 user2
的主目录中,例如 192.168.1.10
。您可以在您的机器上执行此操作1,
scp user2@192.168.1.10:a.txt .
您可以使用rsync
这样使用:
rsync -avz -e ssh remoteuser@remotehost:/remote/dir /this/dir/
Here is step by step tutorial. You can read about differences between rsync
and scp
here