conv
Convert character encodings of files
SYNOPSIS
dd if=
PARAMETERS
ascii
Convert EBCDIC to ASCII.
ebcdic
Convert ASCII to EBCDIC.
ibm
Convert ASCII to alternate EBCDIC.
block
Pad newline-terminated records with spaces to fixed size cbs bytes.
unblock
Replace trailing spaces in fixed size cbs blocks with newline.
lcase
Change uppercase to lowercase.
ucase
Change lowercase to uppercase.
swab
Swap every pair of input bytes.
noerror
Continue after read errors.
notrunc
Do not truncate the output file.
sync
Pad every input block with NULs to ibs-size; when used with block or unblock, pad with spaces instead.
sparse
Try to seek rather than write zero output blocks.
fdatasync
Physically write output file data before finishing.
fsync
Likewise, but also physically write metadata.
DESCRIPTION
The `conv` command, typically invoked through `dd` (Data Definition), is a utility used primarily for converting and copying files. It's commonly employed to manipulate file formats, character encodings, block sizes, and to perform other data transformations during the copying process. While `dd` focuses on low-level data copying, the `conv` option within `dd` provides the ability to apply various conversions on the fly.
Common use cases include converting between ASCII and EBCDIC, swapping bytes, padding blocks with nulls or spaces, and converting between upper and lower case. The `conv` option accepts a comma-separated list of conversion specifications. Understanding the specific conversion options is critical to using `conv` effectively and avoiding unintended data corruption. Using `dd` with `conv` can be powerful for data manipulation, but also dangerous, because of the direct, low-level actions.
CAVEATS
Incorrect usage of `conv` can lead to data loss or corruption.
Always double-check the specified conversion options before executing the `dd` command.
COMMON USE CASES
Disk Imaging: Creating backups of entire hard drives or partitions.
Data Recovery: Attempting to recover data from damaged storage media.
Character Encoding Conversion: Converting text files between different character encodings (e.g., ASCII to UTF-8).
Data Sanitization: Securely erasing data from storage devices by overwriting them with zeros or random data.
PERFORMANCE CONSIDERATIONS
Using `conv` options, especially those involving character encoding conversions, can significantly impact the performance of the `dd` command. The transformations introduce overhead that slows down the copying process. For large files or disks, consider the performance implications and choose conversions judiciously. Using `noerror` might impact performance in faulty devices.
HISTORY
The `conv` option is part of the `dd` utility, which has a long history dating back to early Unix systems. Its primary purpose was to copy and convert data between different storage devices or formats. Over time, the `conv` option was added to provide more flexibility in data transformation during the copying process. The options available and behavior have evolved alongside operating system and hardware developments.