复制本地文件到远程
scp命令——拷贝树莓派数据到本地
场景:Mac下ssh登陆树莓派,树莓派上的文件拷贝到本地。
实现方式:scp命令并且mac上开启ssh服务
语法规则
scp [raspberry pi file path] macname@192.168.1.101:[local file path]
会询问你是否远程链接mac
选择 yes
会提示你输入mac密码
Passord:
输入mac密码
实例
```
pi@xxxxxx:/usr/share/nginx/html/yunchuang.zhijia.com$scp php_mysql/ macname@192.168.1.101:/home/xxx/
The authenticity of host'192.168.1.101 (192.168.1.101)'can't be established.
ECDSA key fingerprint is 2f:5g:78:03:9e:3a:52:c5:70:ea:77:a4:cf:23:3d:ba.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.101' (ECDSA) to the list of known hosts.
Password:
php_mysql: not a regular file
pi@xxxxxx:/usr/share/nginx/html/yunchuang.zhijia.com$ scp php_mysql/
macname@192.168.1.101:~/home/xxx/
Password:
php_mysql: not a regular file
pi@xxxxxx:/usr/share/nginx/html/yunchuang.zhijia.com$
```
注意这句php_mysql: not a regular file不是一个常规文件,不带参数不能直接copy整个目录。
```
pi@xxxxxx:/usr/share/nginx/html/yunchuang.zhijia.com$scp php_mysql/create_db.php macname@192.168.1.101:~/home/xxx/
Password:create_db.php
100% 338 0.3KB/s 00:00
```
好了,一次copy一个文件。
scp拷贝一个文件夹下面所有(包含文件夹和文件)
sudo scp -r xxxxxx@192.168.1.102:/Users/xxxxxx/Downloads/nginx-rtmp-module .
复制远程文件到本地
localhost:~ xxx$ scp pi@192.168.1.100:~/workspace/NASA/NASA-master/car.py .
pi@192.168.1.100's password:
car.py 100% 3545 313.6KB/s 00:00
localhost:~ wangliang$
网友评论