目录
写在前面
1、本文内容
使用scp将ubuntu虚拟机中的文件传输至windows主机,反之亦然
2、平台
windows10, windows下的ubuntu虚拟机
3、转载请注明出处:
https://blog.csdn.net/qq_41102371/article/details/125183312
windows主机向ubuntu发送/获取文件
1、ubuntu中的测试文件
在/home/carlos/路径下准备好测试文件ubuntu_file.txt
2、ubuntu ip地址
ubuntu虚拟机中打开命令行终端,查看ip地址
ifconfig
这里是192.168.245.129
3、在windows上用命令行获取
建立测试文件D:/scp_test/windows_file.txt
打开cmd,cd到D:/scp_test/
d:
cd scp_test
检查ip是否正确
ping 192.168.245.129
scp传输文件
scp carlos@192.168.245.129:/home/carlos/ubuntu_file.txt ./
出现 are you sure you want to continue connecting (yes/no),输入yes,接着输入密码
(carlos是ubuntu的当前用户,密码是用户carlos的密码)
传输完成后,可以在windows上看到传输过来的文件ubuntu_file.txt
也可以将本地的文件传输至虚拟机
scp ./windows_file.txt carlos@192.168.245.129:/home/carlos/
ubuntu主机向windows发送/获取文件
同理,在windows使用查看ip
ipconfig
(注意windows上是ipconfig,ubuntu是ifconfig)
在ubuntu中准备好测试文件/home/carlos/ubuntu_file1.txt
打开命令行
scp /home/carlos/ubuntu_file1.txt 123456@192.168.0.102:D:/scp_test/
windows中查看已传输过来的ubuntu_file1.txt文件
完
--------------------------------------------------------------------------------------------诺有缸的高飞鸟202206