linux拷貝命令之高級(jí)拷貝scp命令詳解
Linux命令scp
scp — secure copy (remote file copy program):她是一個(gè)安全的遠(yuǎn)程文件拷貝程序。
SYNOPSIS :語(yǔ)法如下
scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port] [-S program]
[[user@]host1:]file1 ... [[user@]host2:]file2
看到上面各種參數(shù)、選項(xiàng)蒙了吧。不過(guò),沒(méi)有關(guān)系,我們化整為零,一個(gè)一個(gè)來(lái)分析。
其實(shí),這個(gè)命令和我們平時(shí)使用的cp 十分的相似。
scp 最簡(jiǎn)單的用法就是 scp [[user@]host1:]file1 ... [[user@]host2:]file2 ,能看懂么?
看不懂也沒(méi)有關(guān)系,舉個(gè)例子吧: 我要從192.168.1.2的Linux 主機(jī)的/home/oracle/*.tar 文件 拷貝到 192.168.1.3 的Linux主機(jī)的 /home/siebel下,就可以仿照上面的格式寫成:
scp oracle@192.168.1.2:/home/oracle/*.tar siebel@192.168.1.3:/siebel/
輸入完了以上命令,回車換行確認(rèn),可能會(huì)讓你輸入口令,根據(jù)提示輸入口令吧。
第一次執(zhí)行的時(shí)候,出現(xiàn)如下錯(cuò)誤:ssh: connect to host 192.168.1.99 port 22: Connection refused, 于是將 sshd 程序啟動(dòng),執(zhí)行腳本: # /etc/init.d/sshd start, 成功解決以上問(wèn)題。
至于該命令的其他參數(shù),平時(shí)工作之中基本用不到,所以,不舉例了,簡(jiǎn)單給大家翻譯一下吧,以做參考。
DESCRIPTION : 描述
scp copies files between hosts on a network. It uses ssh(1) for data transfer, and uses the same authentication and provides the same security as ssh(1). Unlike rcp(1), scp will ask for passwords or passphrases if they are needed for authentication.
scp 在網(wǎng)絡(luò)主機(jī)之間拷貝數(shù)據(jù),她使用ssh(1)來(lái)進(jìn)行數(shù)據(jù)傳輸,同時(shí)使用相同的安全驗(yàn)證方式。不象 rcp(1), scp 在必要的時(shí)候,會(huì)詢問(wèn)口令。
The options are as follows:
具體的選項(xiàng)如下所示:
-1 Forces scp to use protocol 1.
強(qiáng)制 scp 使用協(xié)議1
-2 Forces scp to use protocol 2.
強(qiáng)制 scp 使用協(xié)議2
-3 Copies between two remote hosts are transferred through the local host.Without this option the data is copied
directly between the two remote hosts.Note that this option disables the progress meter.
通過(guò)本機(jī)主機(jī)在兩個(gè)遠(yuǎn)程主機(jī)之間傳輸數(shù)據(jù)。沒(méi)有這個(gè)選項(xiàng),數(shù)據(jù)將直接在遠(yuǎn)程主機(jī)間拷貝數(shù)據(jù)。 注意:這個(gè)選項(xiàng)不支持進(jìn)度條顯示。
-4 Forces scp to use IPv4 addresses only.
強(qiáng)制scp只使用IPV4地址。
-6 Forces scp to use IPv6 addresses only.
強(qiáng)制scp只使用IPV6地址。
-B Selects batch mode (prevents asking for passwords or passphrases).
使用批量模式(避免詢問(wèn)密鑰或者口令)
-C Compression enable.Passes the -C flag to ssh(1) to enable compression.
啟用壓縮。傳遞-C參數(shù)給SSH以啟用壓縮
-c cipher
Selects the cipher to use for encrypting the data transfer.This option is directly passed to ssh(1).
選擇密碼加密數(shù)據(jù)傳輸,這個(gè)選項(xiàng)被直接傳遞給ssh(1)。
-F ssh_config
Specifies an alternative per-user configuration file for ssh.This option is directly passed to ssh(1).
為ssh指定一個(gè)交互的用戶配置文件,這個(gè)選項(xiàng)被直接傳遞給ssh(1)。
-l limit
Limits the used bandwidth, specified in Kbit/s.
限制使用的帶寬,以Kb為單位。
-P port
Specifies the port to connect to on the remote host.
在遠(yuǎn)程主機(jī)上指定鏈接端口
-q Quiet mode
靜默模式:
-r Recursively copy entire directories
遞歸拷貝整個(gè)目錄
-S program
Name of program to use for the encrypted connection.The program must understand ssh(1) options.
用來(lái)加密鏈接的程序。這個(gè)程序需要能夠識(shí)別ssh(1)的選項(xiàng)。
EXIT STATUS
執(zhí)行后狀態(tài)
The scp utility exits 0 on success, and >0 if an error occurs.
scp 工具命令當(dāng)成功執(zhí)行后,返回代碼為0, 任何錯(cuò)誤出現(xiàn)返回代碼都大于0
- linux采用scp命令拷貝文件到本地,拷貝本地文件到遠(yuǎn)程服務(wù)器的方法
- Linux使用scp命令進(jìn)行文件遠(yuǎn)程拷貝詳解
- 詳談Linux寫時(shí)拷貝技術(shù)(copy-on-write)必看篇
- Linux中拷貝 cp命令中拷貝所有的寫法詳解
- Virtualbox主機(jī)和虛擬機(jī)之間文件夾共享及雙向拷貝(Windows<->Windows, Windows<->Linux)
- linux使用scp命令備份文件 scp拷貝文件
- 使用scp獲取遠(yuǎn)程linux服務(wù)器上的文件 linux遠(yuǎn)程拷貝文件
- linux下如何實(shí)現(xiàn)快速拷貝大文件
相關(guān)文章
解讀Linux下ip命令展示的網(wǎng)絡(luò)連接信息
這篇文章主要給大家介紹了關(guān)于Linux下解讀ip命令展示的網(wǎng)絡(luò)連接信息的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起看看吧。2018-03-03centos開機(jī)自動(dòng)啟動(dòng)RabbitMq軟件的方法
本文詳細(xì)講解了centos開機(jī)自動(dòng)啟動(dòng)RabbitMq軟件的方法,文中通過(guò)示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以收藏下2021-11-11Linux下設(shè)置每天自動(dòng)備份數(shù)據(jù)庫(kù)的方法
這篇文章主要介紹了Linux下設(shè)置每天自動(dòng)備份數(shù)據(jù)庫(kù)的方法,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2019-09-09