dos2unix(1) 2026-05-28 dos2unix(1) dos2unix - DOS/Mac - Unix dos2unix [] [ ] [-n ...] unix2dos [] [ ] [-n ...] dos2unix"dos2unix""unix2dos"DOSMacUnix DOS/WindowsCRLFUnixLFMacCRMac OS XLFMac OS dos2unixDOSUnix Latin-1Windows UnicodeUTF-16Unix UnicodeUTF-8 Windows dos2unixSunOS/SolarisSunOS/Solaris "-o" "-n"SunOS/Solaris iso ascii -- "-foo" dos2unix -- -foo dos2unix -n -- -foo out.txt --allow-chown "-o" "-n" dos2unix / -ascii CONVERSION MODES -iso DOSISO-8859-1 CONVERSION MODES -1252 Windows 1252 -437 DOS 437 ISO -850 DOS 850 -860 DOS 860 -863 DOS 863 -865 DOS 865 -7 87 -b, --keep-bom BOMBOMBOMDOS "-r" -c, --convmode ascii7bitisomacascii -D, --display-enc ENCODAGE ansiunicodeunicodebomutf8utf8bom ansi UnicodeWindowsdos2unix Windows ansi dos2unixANSIrasterTrueType "chcp" DOS OEMWindowsANSIdos2unixWindows ansi unicodeunicodebom UnicodeWindowsUTF-16TrueTypeTrueType ConEmuConEmu UnicodeASCII "unicodebom" UnicodeBOMPowerShellBOM utf8utf8bom utf8ASCIITrueTypeTrueType "unicode" rasterASCIIunicodeWindows ConEmuutf "utf8bom" UnicodeBOMPowerShellBOM DOS2UNIX_DISPLAY_ENC "unicode" "unicodebom""utf8" "utf8bom" -e, --add-eol DOSUnixPOSIXUnix --error-binary Return an error if a binary file is skipped. -f, --force -gb, --gb18030 WindowsUTF-16UTF-8UTF-16GB18030Windows GB18030 -h, --help -i[], --info[=] DOSUnixMacBOM/ 6 0 0 no_bom text dos.txt 0 6 0 no_bom text unix.txt 0 0 6 no_bom text mac.txt 6 6 6 no_bom text mixed.txt 50 0 0 UTF-16LE text utf16le.txt 0 50 0 no_bom text utf8unix.txt 50 0 0 UTF-8 text utf8dos.txt 2 418 219 no_bom binary dos2unix.exe "-s" "-e" "--add-eol" "noeol" 6 0 0 no_bom text dos dos.txt 0 6 0 no_bom text unix unix.txt 0 0 6 no_bom text mac mac.txt 1 0 0 no_bom text noeol noeol_dos.txt 0 "\0" c xargs(1) -0 "--null" d DOS u Unix m Mac b BOM t e "noeol" c "c"dos2unixDOSunix2dosUnix "-e" "--add-eol" h p *.txt dos2unix -i *.txt DOSUnix dos2unix -idu *.txt BOM dos2unix --info=b *.txt DOS dos2unix -ic *.txt Unix unix2dos -ic *.txt DOS dos2unix -e -ic *.txt DOS dos2unix -ic0 *.txt | xargs -0 dos2unix DOS find -name '*.txt' -print0 | xargs -0 dos2unix -ic -k, --keepdate -L, --license -l, --newline dos2unixDOSUnixMacMacUnix unix2dosUnixDOSMacUnixMac -m, --add-bom BOMUTF-8 BOM UTF-16 "-u"UTF-16 BOM UTF-8UTF-16GB18030 UNICODE -n, --newline ... / umask(1) --no-allow-chown /"-o" "-n" dos2unix / --no-add-eol Do not add a line break to the last line if there isn't one (default). --no-error-binary Do not return an error if a binary file is skipped (default). -O, --to-stdout Unix "-o" "-e"Unicode dos2unix -e -O file1.txt file2.txt > output.txt -o, --oldfile ... /rootUnix/ dos2unix "dos2unix -V" dos2unix dos2unix /"--allow-chown" dos2unix --allow-chown foo.txt dos2unix -n foo.txt foo.txt "--allow-chown" -q, --quiet 0 -r, --remove-bom BOMBOMUnix "-b" -s, --safe 100% By default, no error is returned when a binary file is skipped. When the "--error-binary" option is used, an error is returned. -u, --keep-utf16 Keep the original UTF-16 encoding of the input file. The output file will be written in the same UTF-16 encoding, little- or big-endian, as the input file. This prevents transformation to UTF-8. An UTF-16 BOM will be written accordingly. This option can be disabled with the "-ascii" option. -ul, --assume-utf16le UTF-16LE BOM UTF-16LEUTF-8 iconv(1) UTF-8UTF-16LE UTF-16LE l<> l -ub, --assume-utf16be UTF-16BE "-ul" -v, --verbose BOM -F, --follow-symlink -R, --replace-symlink -S, --skip-symlink -V, --version Mac DOSUnixMac MacMacUnixDOS Mac "-c mac" "mac2unix" "unix2mac" ascii ASCIIASCIIUTF-8ascii7bitiso dos2unixUTF-16UTF-16POSIXWindowsUTF-8 ascii UTF-16"-u"UTF-16"-ul" "-ub"dos2unixUTF-16 "dos2unix -V" UNICODE 7bit 8ASCII128-2557 iso UnixDOSISO ISO-8859-1Latin-1 ISO-8859-1 DOS"." ISO-8859-1 DOS "-iso" dos2unix CP437 -437-850-860-863-865 Windows CP1252 -1252 iconv(1) dos2unixiconv UnicodeISOUTF-8 DOSUnix Latin-1 dos2unix -iso -n in.txt out.txt DOS CP850Unix Latin-1 dos2unix -850 -n in.txt out.txt Windows CP1252Unix Latin-1 dos2unix -1252 -n in.txt out.txt WIndows CP1252Unix UTF-8Unicode iconv -f CP1252 -t UTF-8 in.txt | dos2unix > out.txt Unix Latin-1DOS unix2dos -iso -n in.txt out.txt Unix Latin-1DOS CP850 unix2dos -850 -n in.txt out.txt Unix Latin-1Windows CP1252 unix2dos -1252 -n in.txt out.txt Unix UTF-8UnicodeWindows CP1252 unix2dos < in.txt | iconv -f UTF-8 -t CP1252 > out.txt See also and . UNICODE There exist different Unicode encodings. On Unix and Linux Unicode files are typically encoded in UTF-8 encoding. On Windows Unicode text files can be encoded in UTF-8, UTF-16, or UTF-16 big-endian, but are mostly encoded in UTF-16 format. UnicodeDOSUnixMacASCII dos2unixunix2dosUTF-8UTF-8ASCII dos2unix and unix2dos with Unicode UTF-16 support, can read little- and big-endian UTF-16 encoded text files. To see if dos2unix was built with UTF-16 support type "dos2unix -V". Unix/LinuxUTF-16 locale(1) WindowsUTF-16UTF-8WindowsUnix/LinuxUTF-8 UTF-16UTF-8UTF-16 "-u" UTF-16"-u"UTF-8 dos2unixunix2dosUTF-8UTF-16 ISO7UTF-16 WindowsBOMWindowsBOM UnixUnicodeBOM dos2unixBOMUTF-16UTF-16BOMdos2unix "-ul" "-ub" BOMUTF-16 dos2unixBOM "-b" dos2unixBOMBOM unix2dosBOMBOM "-r" BOM "-m" dos2unixunix2dosBOM WindowsUnicode dos2unixWindowsUnicodedos2unixANSIWindowsdos2unixUnicode "dos2unix -V" WindowsUnicode "-D" "--display-enc" Unicode Windows UTF-16Unix UTF-8 dos2unix -n in.txt out.txt Windows UTF-16LEBOMUnix UTF-8 dos2unix -ul -n in.txt out.txt Unix UTF-8Windows UTF-8BOM unix2dos -m -n in.txt out.txt Unix UTF-8Windows UTF-16 unix2dos < in.txt | iconv -f UTF-8 -t UTF-16 > out.txt GB18030 GB18030GB18030 GB18030UnicodeUnicodeUTF-8GB18030ASCIIGB18030Windows 936GBK Unix/LinuxGB18030UTF-16GB18030 "locale -a" Windows "-gb" UTF-16GB18030 GB18030UnicodeBOM dos2unix < a.txt cat a.txt | dos2unix a.txtb.txt dos2unix a.txt b.txt dos2unix -o a.txt b.txt a.txtascii dos2unix a.txt a.txtasciib.txt7 dos2unix a.txt -c 7bit b.txt dos2unix -c ascii a.txt -c 7bit b.txt dos2unix -ascii a.txt -7 b.txt a.txtMacUnix dos2unix -c mac a.txt mac2unix a.txt a.txtUnixMac unix2dos -c mac a.txt unix2mac a.txt a.txt dos2unix -k a.txt dos2unix -k -o a.txt a.txte.txt dos2unix -n a.txt e.txt a.txte.txte.txta.txt dos2unix -k -n a.txt e.txt a.txtb.txte.txt dos2unix a.txt -n b.txt e.txt dos2unix -o a.txt -n b.txt e.txt c.txte.txta.txtb.txtd.txtf.txt dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt find(1) xargs(1) dos2unix .txt dos2unix < a.txt cat a.txt | dos2unix find(1) "-print0" xargs(1) -0 "-exec" find(1) find . -name '*.txt' -exec dos2unix {} \; Windows for /R %G in (*.txt) do dos2unix "%G" PowerShellWindows PowerShell get-childitem -path . -filter '*.txt' -recurse | foreach-object {dos2unix $_.Fullname} LANG LANG/POSIX export LANG=zh export LANG=zh_CN export LANG=zh_TW export LANG=es_ES export LANG=es_MX export LANG=en_US.iso88591 Latin-1 export LANG=en_GB.UTF-8 UTF-8 /gettext Unix locale(1) LANGUAGE LANGUAGEdos2unixLANGUAGELANG"LANGUAGE=zh:en"LANGLC_ALL"C"gettext DOS2UNIX_LOCALEDIR DOS2UNIX_LOCALEDIRLOCALEDIRLOCALEDIRGNU "/usr/local/share/locale" --version LOCALEDIR POSIX shell export DOS2UNIX_LOCALEDIR=$HOME/share/locale 01 0 Benjamin Lin - Bernd Johannes Wuebbenmac2unix - Christian Wurll - Erwin Waterlander - Project page: SourceForge file(1) find(1) iconv(1) locale(1) xargs(1) dos2unix 2026-05-28 dos2unix(1)