dos2unix
convert DOS/Windows line endings to Unix
TLDR
Convert file line endings
SYNOPSIS
dos2unix [options] [file...]
DESCRIPTION
dos2unix converts text files from DOS/Windows format (CRLF line endings) to Unix format (LF line endings). DOS/Windows systems use carriage return and line feed (\\r\\n) to mark line endings, while Unix-like systems use only line feed (\\n).
Line ending mismatches cause problems in scripts, compilation errors, or rendering issues in text editors. This tool resolves these issues by normalizing line endings to the Unix standard. It handles byte order marks (BOM) commonly found in UTF-8 files from Windows.
The tool operates in-place by default, modifying the original file, but can create new output files preserving the original. It intelligently detects file formats and can provide information about a file's current line ending format before conversion.
PARAMETERS
-n, --newfile in out
Write to new file instead of in-place-i, --info [flags]
Display file information--keep-bom
Keep Byte Order Mark--add-bom
Add Byte Order Mark--remove-bom
Remove Byte Order Mark-c, --convmode mode
Conversion mode (ascii, 7bit, iso)
CAVEATS
Modifies files in place by default; use -n to preserve original. Binary files may be corrupted. Check with -i before converting.
