自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

舉例說明Linux壓縮命令(三)compress 、dd

系統(tǒng) Linux
Linux壓縮命令第三講,這里介紹兩個Linux壓縮命令compress 命令和dd 命令,還是和前兩篇文章一樣,詳細(xì)舉例說明。

Linux壓縮解壓命令這個系列這里是第三講了,前面我們介紹了五種命令,這里繼續(xù)介紹兩外兩個Linux壓縮解壓命令compress 命令和dd 命令 ,不多說了,還是和前面一樣,邊講邊舉例說明。

compress 命令

[root@linux ~]# compress [-dcr] 文件或目錄
◆參數(shù):
-d :用來解壓縮的參數(shù)
-r :可以連同目錄下的文件也同時給予壓縮呢!
-c :將壓縮資料輸出成為 standard output (輸出到螢?zāi)?
◆范例:
范例一:將 /etc/man.config 複制到 /tmp ,并加以壓縮
[root@linux ~]# cd /tmp
[root@linux tmp]# cp /etc/man.config .
[root@linux tmp]# compress man.config
[root@linux tmp]# ls -l
-rw-r--r-- 1 root root 2605 Jul 27 11:43 man.config.Z
范例二:將剛剛的壓縮檔解開
[root@linux tmp]# compress -d man.config.Z

范例三:將 man.config 壓縮成另外一個文件來備份
[root@linux tmp]# compress -c man.config > man.config.back.Z
[root@linux tmp]# ll man.config*
-rw-r--r-- 1 root root 4506 Jul 27 11:43 man.config
-rw-r--r-- 1 root root 2605 Jul 27 11:46 man.config.back.Z
# 這個 -c 的參數(shù)比較有趣!他會將壓縮過程的資料輸出到螢?zāi)簧?,而不是寫入成?BR># file.Z 文件。所以,我們可以透過資料流重導(dǎo)向的方法將資料輸出成為另一個檔名。
# 關(guān)於資料流重導(dǎo)向,我們會在 bash shell 當(dāng)中詳細(xì)談?wù)摰睦玻?/P>

dd 命令

[root@linux ~]# dd if="input_file" of="outptu_file" bs="block_size" \
count="number"
◆參數(shù):
if :就是 input file 啰~也可以是裝置喔!
of :就是 output file 喔~也可以是裝置;
bs :規(guī)劃的一個 block 的大小,如果沒有設(shè)定時,預(yù)設(shè)是 512 bytes
count:多少個 bs 的意思。
◆范例:
范例一:將 /etc/passwd 備份到 /tmp/passwd.back 當(dāng)中
[root@linux ~]# dd if=/etc/passwd of=/tmp/passwd.back
3+1 records in
3+1 records out
[root@linux ~]# ll /etc/passwd /tmp/passwd.back
-rw-r--r-- 1 root root 1746 Aug 25 14:16 /etc/passwd
-rw-r--r-- 1 root root 1746 Aug 29 16:57 /tmp/passwd.back
# 仔細(xì)的看一下,我的 /etc/passwd 文件大小為 1746 bytes,因為我沒有設(shè)定 bs ,
# 所以預(yù)設(shè)是 512 bytes 為一個單位,因此,上面那個 3+1 表示有 3 個完整的
# 512 bytes,以及未滿 512 bytes 的另一個 block 的意思啦!
# 事實上,感覺好像是 cp 這個指令啦~

范例二:備份 /dev/hda 的 MBR
[root@linux ~]# dd if=/dev/hda of=/tmp/mbr.back bs=512 count=1
1+0 records in
1+0 records out
# 這就得好好瞭解一下啰~我們知道整顆硬盤的 MBR 為 512 bytes,
# 就是放在硬盤的***個 sector 啦,因此,我可以利用這個方式來將
# MBR 內(nèi)的所有資料都紀(jì)錄下來,真的很厲害吧! ^_^

范例三:將整個 /dev/hda1 partition 備份下來。
[root@linux ~]# dd if=/dev/hda1 of=/some/path/filenaem
# 這個指令很厲害啊!將整個 partition 的內(nèi)容全部備份下來~
# 后面接的 of 必須要不是在 /dev/hda1 的目錄內(nèi)啊~否則,怎么讀也讀不完~
# 這個動作是很有效用的,如果改天你必須要完整的將整個 partition 的內(nèi)容填回去,
# 則可以利用 dd if=/some/file of=/dev/hda1 來將資料寫入到硬盤當(dāng)中。
# 如果想要整個硬盤備份的話,就類似 Norton 的 ghost 軟體一般,
# 由 disk 到 disk ,嘿嘿~利用 dd 就可以啦~厲害厲害!

前面忘記說了,這些Linux壓縮解壓命令一定要自己親手實踐才有效果。

【編輯推薦】

  1. 舉例說明Linux壓縮解壓命令第二講
  2. 舉例說明Linux壓縮解壓命令第二講
  3. 總結(jié)Linux壓縮解壓的所有命令
  4. 詳細(xì)剖析Linux睡眠休眠狀態(tài)
  5. 選擇Linux認(rèn)證之路的理由
責(zé)任編輯:小霞 來源: 互聯(lián)網(wǎng)
相關(guān)推薦

2010-03-04 13:21:32

linux壓縮命令

2013-11-26 11:08:23

Linux命令diff

2010-06-22 13:08:42

Linux At命令

2010-03-04 13:33:28

Linux壓縮命令

2018-11-28 08:20:15

Linuxalias命令

2010-06-18 10:24:51

Linux acces

2009-09-25 09:30:33

Hibernate持久

2010-01-12 15:56:25

C++軟件

2010-01-18 17:31:54

C++編寫程序

2010-01-21 09:53:23

C++操作符

2010-03-03 10:55:39

2010-03-04 15:00:12

Linux不同網(wǎng)段訪問

2010-01-06 16:54:07

.Net Framew

2009-10-21 13:17:38

Linux壓縮打包方法

2010-03-04 13:54:39

Linux壓縮命令

2010-01-08 17:06:52

C++代碼

2009-12-07 17:28:55

WCF數(shù)據(jù)

2010-04-09 16:52:36

Unix操作系統(tǒng)

2009-08-11 10:34:41

linux中du命令參linux命令行參數(shù)linux命令行

2009-10-21 13:43:04

Linux壓縮方法
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號