最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Linux中dd命令使用實(shí)例教程

 更新時(shí)間:2017年05月21日 11:29:32   作者:hbxztc  
dd命令用指定大小的塊拷貝一個(gè)文件,并在拷貝的同時(shí)進(jìn)行指定的轉(zhuǎn)換。下面這篇文章主要給大家介紹了關(guān)于Linux中dd命令使用的相關(guān)資料,對大家具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起看看吧。

本文主要給大家介紹了關(guān)于Linux中dd命令使用的相關(guān)內(nèi)容,分享出來供大家參考學(xué)習(xí),下面來看看詳細(xì)的介紹:

一、Linux dd命令用指定大小的塊拷貝一個(gè)文件,并在拷貝的同時(shí)進(jìn)行指定的轉(zhuǎn)換。

使用方法:dd [OPERAND]

參數(shù)注釋:

 bs=BYTES  read and write BYTES bytes at a time (also see ibs=,obs=)
 cbs=BYTES  convert BYTES bytes at a time
 conv=CONVS  convert the file as per the comma separated symbol list
 count=N   copy only N input blocks
 ibs=BYTES  read BYTES bytes at a time (default: 512)
 if=FILE   read from FILE instead of stdin(默認(rèn)為標(biāo)準(zhǔn)輸入)
 iflag=FLAGS  read as per the comma separated symbol list
 obs=BYTES  write BYTES bytes at a time (default: 512)
 of=FILE   write to FILE instead of stdout(默認(rèn)為標(biāo)準(zhǔn)輸出)
 oflag=FLAGS  write as per the comma separated symbol list
 seek=BLOCKS  skip BLOCKS obs-sized blocks at start of output
 skip=BLOCKS  skip BLOCKS ibs-sized blocks at start of input
 status=WHICH WHICH info to suppress outputting to stderr;
     'noxfer' suppresses transfer stats, 'none' suppresses all

CONVS的可選參數(shù)

 ascii  from EBCDIC to ASCII
 ebcdic from ASCII to EBCDIC
 ibm  from ASCII to alternate EBCDIC
 block  pad newline-terminated records with spaces to cbs-size
 unblock replace trailing spaces in cbs-size records with newline
 lcase  change upper case to lower case
 nocreat do not create the output file
 excl  fail if the output file already exists
 notrunc do not truncate the output file
 ucase  change lower case to upper case
 sparse try to seek rather than write the output for NUL input blocks
 swab  swap every pair of input bytes
 noerror continue after read errors
 sync  pad every input block with NULs to ibs-size; when used
   with block or unblock, pad with spaces rather than NULs
 fdatasync physically write output file data before finishing
 fsync  likewise, but also write metadata

FLAGS的可選參數(shù)

 append append mode (makes sense only for output; conv=notrunc suggested)
 direct use direct I/O for data
 directory fail unless a directory
 dsync  use synchronized I/O for data
 sync  likewise, but also for metadata
 fullblock accumulate full blocks of input (iflag only)
 nonblock use non-blocking I/O
 noatime do not update access time
 noctty do not assign controlling terminal from file
 nofollow do not follow symlinks
 count_bytes treat 'count=N' as a byte count (iflag only)

注意:指定數(shù)字的地方若以下列字符結(jié)尾,則乘以相應(yīng)的數(shù)字:

c =1, w =2, b =512, kB =1000, K =1024, MB =1000*1000, M =1024*1024, xM =M

GB =1000*1000*1000, G =1024*1024*1024, and so on for T, P, E, Z, Y

二、使用實(shí)例

1、將本地的/dev/hdb整盤備份到/dev/hdd

dd if=/dev/hdb of=/dev/hdd

2、將/dev/hdb全盤數(shù)據(jù)備份到指定路徑的image文件

dd if=/dev/hdb of=/root/image

3、備份/dev/hdb全盤數(shù)據(jù),并利用gzip工具進(jìn)行壓縮,保存到指定路徑

dd if=/dev/hdb | gzip > /root/image.gz

4、把一個(gè)文件拆分為3個(gè)文件

#文件大小為2.3k
[Oracle@rhel6 ~]$ ll db1_db_links.sql 
-rw-r--r-- 1 oracle oinstall 2344 Nov 21 10:39 db1_db_links.sql
#把這個(gè)文件拆成每個(gè)文件1k,bs=1k,count=1,使用skip參數(shù)指定在輸入文件中跳過多少個(gè)bs支讀取
[oracle@rhel6 ~]$ dd if=db1_db_links.sql of=dd01.sql bs=1k count=1
1+0 records in
1+0 records out
1024 bytes (1.0 kB) copied, 4.5536e-05 s, 22.5 MB/s
[oracle@rhel6 ~]$ dd if=db1_db_links.sql of=dd02.sql bs=1k count=1 skip=1
1+0 records in
1+0 records out
1024 bytes (1.0 kB) copied, 0.000146387 s, 7.0 MB/s
[oracle@rhel6 ~]$ dd if=db1_db_links.sql of=dd03.sql bs=1k count=1 skip=2
0+1 records in
0+1 records out
296 bytes (296 B) copied, 0.000204216 s, 1.4 MB/s
#拆分出的文件
[oracle@rhel6 ~]$ ll dd*sql
-rw-r--r-- 1 oracle oinstall 1024 May 20 14:58 dd01.sql
-rw-r--r-- 1 oracle oinstall 1024 May 20 14:58 dd02.sql
-rw-r--r-- 1 oracle oinstall 296 May 20 14:58 dd03.sql

5、把拆分出的文件合并為1個(gè)

#合并操作,此時(shí)用到seek參數(shù),用于指定在輸入文件中跳過的bs數(shù)
[oracle@rhel6 ~]$ dd of=1.sql if=dd01.sql 
2+0 records in
2+0 records out
1024 bytes (1.0 kB) copied, 0.000176 s, 5.8 MB/s
[oracle@rhel6 ~]$ dd of=1.sql if=dd02.sql bs=1k seek=1
1+0 records in
1+0 records out
1024 bytes (1.0 kB) copied, 0.000124038 s, 8.3 MB/s
[oracle@rhel6 ~]$ dd of=1.sql if=dd03.sql bs=1k seek=2
0+1 records in
0+1 records out
296 bytes (296 B) copied, 0.00203881 s, 145 kB/s
#與拆分前的文件進(jìn)行校驗(yàn)
[oracle@rhel6 ~]$ diff 1.sql db1_db_links.sql
[oracle@rhel6 ~]$

6、在輸出文件中指定的位置插入數(shù)據(jù),而不截?cái)噍敵鑫募?/strong>

需要使用conv=notrunc參數(shù)

[oracle@rhel6 ~]$ dd if=2.sql of=1.sql bs=1k seek=1 count=2 conv=notrunc

總結(jié)

以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作能帶來一定的幫助,如果有疑問大家可以留言交流,謝謝大家對腳本之家的支持。

相關(guān)文章

  • CentOS安裝jdk的幾種方法及配置環(huán)境變量方式

    CentOS安裝jdk的幾種方法及配置環(huán)境變量方式

    這篇文章主要介紹了CentOS安裝jdk的幾種方法及配置環(huán)境變量方式,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-12-12
  • Gunicorn運(yùn)行與配置方法

    Gunicorn運(yùn)行與配置方法

    這篇文章主要介紹了Gunicorn運(yùn)行與配置方法,使用pre-fork worker模式,具有使用非常簡單,輕量級的資源消耗,以及高性能等特點(diǎn)。對此感興趣的朋友跟隨小編一起看看吧
    2019-08-08
  • Linux系統(tǒng)設(shè)置tomcat開機(jī)自啟介紹

    Linux系統(tǒng)設(shè)置tomcat開機(jī)自啟介紹

    大家好,本篇文章主要講的是Linux系統(tǒng)設(shè)置tomcat開機(jī)自啟介紹,感興趣的同學(xué)趕快來看一看吧,對你有幫助的話記得收藏一下,方便下次瀏覽
    2021-12-12
  • Linux環(huán)境下快速搭建ftp服務(wù)器方法介紹

    Linux環(huán)境下快速搭建ftp服務(wù)器方法介紹

    這篇文章主要介紹了Linux環(huán)境下快速搭建ftp服務(wù)器方法介紹,分享了相關(guān)代碼示例,小編覺得還是挺不錯(cuò)的,具有一定借鑒價(jià)值,需要的朋友可以參考下
    2018-01-01
  • RHEL7使用ssm命令管理LVM的方法

    RHEL7使用ssm命令管理LVM的方法

    下面小編就為大家?guī)硪黄猂HEL7使用ssm命令管理LVM的方法。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2016-12-12
  • Linux使用ncdu查看磁盤使用的操作詳解

    Linux使用ncdu查看磁盤使用的操作詳解

    ncdu?(NCurses?Disk?Usage)?是一個(gè)用于?Linux?和類?unix?系統(tǒng)的磁盤實(shí)用程序,它提供了一種比?du?等傳統(tǒng)命令更具交互性和用戶友好性的方式來查看和分析磁盤空間使用情況,本文給大家介紹了Linux使用ncdu查看磁盤使用的操作,需要的朋友可以參考下
    2025-02-02
  • ubuntu 系統(tǒng)上為php加上redis 擴(kuò)展的實(shí)現(xiàn)方法

    ubuntu 系統(tǒng)上為php加上redis 擴(kuò)展的實(shí)現(xiàn)方法

    這篇文章主要介紹了ubuntu 系統(tǒng)上為php加上redis 擴(kuò)展的實(shí)現(xiàn)方法的相關(guān)資料,希望通過本文能幫助到大家,讓大家實(shí)現(xiàn)這樣的功能,需要的朋友可以參考下
    2017-10-10
  • Linux中別名與二進(jìn)制的使用教程

    Linux中別名與二進(jìn)制的使用教程

    這篇文章主要給大家介紹了關(guān)于Linux中別名與二進(jìn)制的使用方法,文中介紹的非常詳細(xì),對大家具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起看看吧。
    2017-05-05
  • Linux中網(wǎng)絡(luò)性能優(yōu)化與監(jiān)控實(shí)戰(zhàn)詳細(xì)指南

    Linux中網(wǎng)絡(luò)性能優(yōu)化與監(jiān)控實(shí)戰(zhàn)詳細(xì)指南

    在高并發(fā)場景下,Linux服務(wù)器的網(wǎng)絡(luò)性能直接影響用戶體驗(yàn),這篇文章將全面解析Linux網(wǎng)絡(luò)性能優(yōu)化的核心方法,感興趣的小伙伴可以學(xué)習(xí)一下
    2025-04-04
  • Linux外圍文件系統(tǒng)的定制方法

    Linux外圍文件系統(tǒng)的定制方法

    這篇文章主要給大家介紹了關(guān)于Linux外圍文件系統(tǒng)的定制方法,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-02-02

最新評論

成武县| 昔阳县| 洪泽县| 德昌县| 三江| 临江市| 苏州市| 赣州市| 临夏县| 锡林浩特市| 黔西县| 漾濞| 芮城县| 孙吴县| 北辰区| 探索| 万宁市| 湛江市| 即墨市| 那曲县| 湾仔区| 崇阳县| 南安市| 无为县| 怀仁县| 延吉市| 沁水县| 中阳县| 安多县| 海门市| 融水| 綦江县| 庆阳市| 平原县| 新巴尔虎右旗| 增城市| 英吉沙县| 水富县| 象山县| 鲁山县| 保靖县|