0

Linux常用命令-68:dd

 1 year ago
source link: https://xugaoxiang.com/2022/06/22/linux-cmds-68-dd/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

dd 命令用于读取、转换并输出数据。可以从标准输入或文件中读取数据,根据指定的格式来转换数据,再输出到文件、设备或标准输出。

语法格式:dd [参数]

常用参数:

f71ca1acee2ea937.png
# /dev/null,可以向它输出任何数据
# /dev/zero,是一个输入设备,可以用它来初始化文件,该设备无穷尽地提供0
# 备份/dev/sdb全盘数据,使用gzip压缩并保存
dd if=/dev/sdb | gzip > /root/image.gz

# 将压缩的备份文件恢复到指定盘
gzip -dc /root/image.gz | dd of=/dev/sdb

# 测试硬盘的写速度
dd if=/dev/zero bs=1024 count=1000000 of=/root/1Gb.file

# 测试硬盘的读速度
dd if=/root/1Gb.file of=/dev/null bs=64k

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK