麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 服務器 > Linux服務器 > 正文

Linux中dd命令使用實例教程

2024-09-05 23:03:53
字體:
來源:轉載
供稿:網友

本文主要給大家介紹了關于Linux中linux/188170.html">dd命令使用的相關內容,分享出來供大家參考學習,下面來看看詳細的介紹:

一、Linux dd命令用指定大小的塊拷貝一個文件,并在拷貝的同時進行指定的轉換。

使用方法:dd [OPERAND]

參數注釋:

 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(默認為標準輸入) 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(默認為標準輸出) 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的可選參數

 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的可選參數

 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)

注意:指定數字的地方若以下列字符結尾,則乘以相應的數字:

c =1, w =2, b =512, kB =1000, K =1024, MB =1000*1000, M =1024*1024, xM =MGB =1000*1000*1000, G =1024*1024*1024, and so on for T, P, E, Z, Y

二、使用實例

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

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

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

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

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

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

4、把一個文件拆分為3個文件

#文件大小為2.3k[Oracle@rhel6 ~]$ ll db1_db_links.sql -rw-r--r-- 1 oracle oinstall 2344 Nov 21 10:39 db1_db_links.sql#把這個文件拆成每個文件1k,bs=1k,count=1,使用skip參數指定在輸入文件中跳過多少個bs支讀取[oracle@rhel6 ~]$ dd if=db1_db_links.sql of=dd01.sql bs=1k count=11+0 records in1+0 records out1024 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=11+0 records in1+0 records out1024 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=20+1 records in0+1 records out296 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個

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

6、在輸出文件中指定的位置插入數據,而不截斷輸出文件

需要使用conv=notrunc參數

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

總結

以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作能帶來一定的幫助,如果有疑問大家可以留言交流,謝謝大家對VEVB武林網的支持。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 成人在线视频免费观看 | 欧美韩国一区 | 国产精品一区在线观看 | 日本视频免费观看 | 日韩毛片在线看 | 黄色大片高清 | 九九热在线视频观看 | 免费在线观看国产精品 | 久久精品观看 | 日韩激情 | 一级国产免费 | 国产精品美女一区二区 | 五月婷婷第四色 | 欧美亚洲国产一区二区三区 | 污黄视频在线观看 | 毛片在哪里看 | 超碰人人做人人爱 | 久久一区三区 | 91精品国产综合久久久动漫日韩 | 黄色片网站在线免费观看 | 久久综合九色综合久久久精品综合 | 毛片免费观看视频 | 国产chinesehd精品91 | 免费看a级片 | 国产 一区 精品 | 国产午夜精品久久久久久免费视 | 久久精品国产精品亚洲 | 97干色| 免费黄色大片在线观看 | 成av在线 | 91九色免费视频 | 成年性羞羞视频免费观看无限 | 激情在线视频 | 日韩视频中文 | 91av在线免费 | 国产精品视频成人 | 国产高潮好爽好大受不了了 | 一区二区视频在线看 | 国产亚洲综合一区二区 | 午夜视频久久 | 香蕉黄色网|