linux拷貝命令之高級拷貝scp命令詳解
Linux命令scp
scp — secure copy (remote file copy program):她是一個安全的遠(yuǎn)程文件拷貝程序。
SYNOPSIS :語法如下
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ù)、選項蒙了吧。不過,沒有關(guān)系,我們化整為零,一個一個來分析。
其實,這個命令和我們平時使用的cp 十分的相似。
scp 最簡單的用法就是 scp [[user@]host1:]file1 ... [[user@]host2:]file2 ,能看懂么?
看不懂也沒有關(guān)系,舉個例子吧: 我要從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),可能會讓你輸入口令,根據(jù)提示輸入口令吧。
第一次執(zhí)行的時候,出現(xiàn)如下錯誤:ssh: connect to host 192.168.1.99 port 22: Connection refused, 于是將 sshd 程序啟動,執(zhí)行腳本: # /etc/init.d/sshd start, 成功解決以上問題。
至于該命令的其他參數(shù),平時工作之中基本用不到,所以,不舉例了,簡單給大家翻譯一下吧,以做參考。
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)來進(jìn)行數(shù)據(jù)傳輸,同時使用相同的安全驗證方式。不象 rcp(1), scp 在必要的時候,會詢問口令。
The options are as follows:
具體的選項如下所示:
-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.
通過本機(jī)主機(jī)在兩個遠(yuǎn)程主機(jī)之間傳輸數(shù)據(jù)。沒有這個選項,數(shù)據(jù)將直接在遠(yuǎn)程主機(jī)間拷貝數(shù)據(jù)。 注意:這個選項不支持進(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).
使用批量模式(避免詢問密鑰或者口令)
-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ù)傳輸,這個選項被直接傳遞給ssh(1)。
-F ssh_config
Specifies an alternative per-user configuration file for ssh.This option is directly passed to ssh(1).
為ssh指定一個交互的用戶配置文件,這個選項被直接傳遞給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
遞歸拷貝整個目錄
-S program
Name of program to use for the encrypted connection.The program must understand ssh(1) options.
用來加密鏈接的程序。這個程序需要能夠識別ssh(1)的選項。
EXIT STATUS
執(zhí)行后狀態(tài)
The scp utility exits 0 on success, and >0 if an error occurs.
scp 工具命令當(dāng)成功執(zhí)行后,返回代碼為0, 任何錯誤出現(xiàn)返回代碼都大于0
- linux采用scp命令拷貝文件到本地,拷貝本地文件到遠(yuǎn)程服務(wù)器的方法
- Linux使用scp命令進(jìn)行文件遠(yuǎn)程拷貝詳解
- 詳談Linux寫時拷貝技術(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下如何實現(xiàn)快速拷貝大文件
相關(guān)文章
解讀Linux下ip命令展示的網(wǎng)絡(luò)連接信息
這篇文章主要給大家介紹了關(guān)于Linux下解讀ip命令展示的網(wǎng)絡(luò)連接信息的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起看看吧。2018-03-03
Linux下設(shè)置每天自動備份數(shù)據(jù)庫的方法
這篇文章主要介紹了Linux下設(shè)置每天自動備份數(shù)據(jù)庫的方法,非常不錯,具有一定的參考借鑒價值,需要的朋友可以參考下2019-09-09

