NotePublic/Software/Applications/DD/DD_命令说明.md

38 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# DD 命令说明
## 1.一般使用
```bash
# 不固定长度,读到文件结尾自动停止
dd if=\<in file name\> of=/dev/\<out file name\> bs=4M status=progress
# 指定长度4Mx1024=4G
dd if=\<in file name\> of=/dev/\<out file name\> bs=4M count=1024 status=progress
```
## 2.指定 Flag
```bash
# iflag 指定 input flag
# iflag 指定 output flag
dd iflag=direct,nonblock if=\<in file name\> oflag=direct,nonblock of=/dev/\<out file name\> bs=4M status=progress
```
多个 Flag 之间可以用逗号分割,含义如下表。
| Flag | Description |
|-------------|-------------------------------------------------------------------|
| 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 |
| nocache | Request to drop cache. See also oflag=sync |
| noctty | do not assign controlling terminal from file |
| nofollow | do not follow symlinks |
| count_bytes | treat 'count=N' as a byte count (iflag only) |
| skip_bytes | treat 'skip=N' as a byte count (iflag only) |
| seek_bytes | treat 'seek=N' as a byte count (oflag only) |