scp命令——兩臺(tái)機(jī)器之間拷貝文件

復(fù)制本地文件到遠(yuǎn)程

scp命令——拷貝樹(shù)莓派數(shù)據(jù)到本地

場(chǎng)景:Mac下ssh登陸樹(shù)莓派,樹(shù)莓派上的文件拷貝到本地。

實(shí)現(xiàn)方式:scp命令并且mac上開(kāi)啟ssh服務(wù)

語(yǔ)法規(guī)則

scp [raspberry pi file path] macname@192.168.1.101:[local file path]

會(huì)詢問(wèn)你是否遠(yuǎn)程鏈接mac

選擇 yes

會(huì)提示你輸入mac密碼

Passord:

輸入mac密碼

實(shí)例

```

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不是一個(gè)常規(guī)文件,不帶參數(shù)不能直接copy整個(gè)目錄。

```

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一個(gè)文件。

scp拷貝一個(gè)文件夾下面所有(包含文件夾和文件)

sudo scp -r? xxxxxx@192.168.1.102:/Users/xxxxxx/Downloads/nginx-rtmp-module .

復(fù)制遠(yuǎn)程文件到本地

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$

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容