亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Linux中dd命令使用實例教程

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

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

一、Linux dd命令用指定大小的塊拷貝一個文件,并在拷貝的同時進行指定的轉(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(默認為標準輸入)
 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的可選參數(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

二、使用實例

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工具進行壓縮,保存到指定路徑

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參數(shù)指定在輸入文件中跳過多少個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個

#合并操作,此時用到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
#與拆分前的文件進行校驗
[oracle@rhel6 ~]$ diff 1.sql db1_db_links.sql
[oracle@rhel6 ~]$

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

需要使用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)容對大家的學習或者工作能帶來一定的幫助,如果有疑問大家可以留言交流,謝謝大家對腳本之家的支持。

相關(guān)文章

  • 在linux系統(tǒng)下部署selenium爬蟲程序介紹

    在linux系統(tǒng)下部署selenium爬蟲程序介紹

    大家好,本篇文章主要講的是在linux系統(tǒng)下部署selenium爬蟲程序介紹,感興趣的同學速來圍觀哦,記得收藏本篇文章方便下次瀏覽
    2021-11-11
  • APACHE 配置文件中文版 httpd.conf FOR Apache 2.2.13

    APACHE 配置文件中文版 httpd.conf FOR Apache 2.2.13

    APACHE配置文件中文版 httpd.conf FOR Apache 2.2.13 ,綜合網(wǎng)上2.0版本的翻譯,加入自己的理解,補充完善。
    2009-11-11
  • linux文件及用戶管理的實例練習

    linux文件及用戶管理的實例練習

    在本篇文章里小編給大家分享了關(guān)于linux文件及用戶管理的實例練習,需要的朋友們可以學習下。
    2020-02-02
  • 從Centos7升級到Centos8的教程(圖文詳解)

    從Centos7升級到Centos8的教程(圖文詳解)

    這篇文章主要介紹了從Centos7升級到Centos8的教程,在升級之前需要配置備份,本文通過圖文并茂的形式給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友參考下吧
    2019-11-11
  • Ubuntu解壓zip文件亂碼的解決方法

    Ubuntu解壓zip文件亂碼的解決方法

    最近在工作中遇到一個問題,在Ubuntu的系統(tǒng)下解壓zip文件的時候居然出現(xiàn)了亂碼,通過查找網(wǎng)上的資料終于解決了,所以想著把解決問題的兩個方法分享給大家,方便有需要的朋友們能夠參考借鑒,下面來一起看看吧。
    2016-11-11
  • CentOS 7.4下安裝Oracle 11.2.0.4數(shù)據(jù)庫的方法

    CentOS 7.4下安裝Oracle 11.2.0.4數(shù)據(jù)庫的方法

    本篇文章主要介紹了CentOS 7.4下安裝Oracle 11.2.0.4數(shù)據(jù)庫的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-12-12
  • 詳解Linux下安裝php環(huán)境并且配置Nginx支持php-fpm模塊

    詳解Linux下安裝php環(huán)境并且配置Nginx支持php-fpm模塊

    本篇文章主要介紹了詳解Linux下安裝php環(huán)境并且配置Nginx支持php-fpm模塊,具有一定的參考價值,感興趣的小伙伴們可以參考一下。
    2017-03-03
  • Linux下部署springboot項目的方法步驟

    Linux下部署springboot項目的方法步驟

    這篇文章主要介紹了Linux下部署springboot項目的方法步驟,由于springboot是內(nèi)嵌了tomcat,所以可以直接將項目打包上傳至服務(wù)器上,具體實例方法大家參考下本文
    2018-06-06
  • Linux YUM倉庫及NFS共享服務(wù)方式

    Linux YUM倉庫及NFS共享服務(wù)方式

    YUM(Yellowdog Updater Modified)是基于RPM包的軟件包管理器,專門用于解決軟件包的依賴關(guān)系,支持通過FTP、HTTP服務(wù)或本地目錄從集中的YUM軟件倉庫獲取軟件包,YUM能夠自動處理包依賴問題,簡化了軟件安裝和更新過程
    2024-09-09
  • CentOS8 Linux 8.0.1905的安裝過程(圖解)

    CentOS8 Linux 8.0.1905的安裝過程(圖解)

    這篇文章主要介紹了CentOS Linux 8.0.1905的安裝過程,本文通過圖文并茂的形式給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下
    2019-10-10

最新評論