scp命令用于通過ssh在兩臺服務器之間傳輸文件。大多數(shù)scp用戶在系統(tǒng)中已經(jīng)可以使用scp命令,但它仍然顯示“bash:scp:command not found”。因此注意,scp命令必須在本地和遠程系統(tǒng)上都可用才可以避免這個問題。
安裝SCP命令包
scp命令來自Red Hat系統(tǒng)上的openssh-clients軟件包,openssh-client軟件包用于基于debian的系統(tǒng)。可以使用以下命令在linux操作系統(tǒng)上安裝scp命令包。
centos / RHEL和Fedora
#yum?install?openssh-clients
Ubuntu和Debian
$?sudo?apt-get?install?openssh-client
使用SCP命令傳輸文件
本地到遠程:要將文件/opt/myfile.txt從本地傳輸?shù)竭h程(remote.example.com)系統(tǒng)的/opt/Directory,可以使用以下命令。
#?scp?/opt/myfile.txt?remote.example.com:/opt/
遠程到本地:要將文件/opt/myfile.txt從遠程(remote.example.com)系統(tǒng)傳輸?shù)奖镜叵到y(tǒng)/ opt目錄,使用以下命令。
#scp?remote.example.com:/opt/myfile.txt?/?opt?/
本篇文章到這里就已經(jīng)全部結(jié)束了,更多其他精彩內(nèi)容可以關(guān)注php中文網(wǎng)的其他相關(guān)欄目教程!!!
? 版權(quán)聲明
文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載。
THE END