dos2unix(1) 2026-08-27 dos2unix(1) dos2unix - /- dos2unix [] [ ...] [-n _ _ ...] unix2dos [] [ ...] [-n _ _ ...] "dos2unix" ,,"dos2unix"" ,,"unix2dos"" . / , , : ,,Carriage Return" (CR) ,,Line Feed" (LF). : ,,Line Feed" (LF). , -, ,,Carriage Return" (CR). (LF). ,,dos2unix" . Latin-1. (UTF-16) (UTF-8) . , . , , . . , . . ,,dos2unix" ,,dos2unix" /. / . ( ), / ( ). ,,"-o"" ,,"-n"". / ,,iso" ,,ascii" . -- . . ,,-foo", : dos2unix -- -foo : dos2unix -n -- -foo .txt --allow-chown . , / . . ,,"-o"" ,,"-n"". ,,dos2unix" . -ascii . . -iso -8859-1 . . -1252 1252 (). -437 437 ( ). . -850 850 (). -860 860 (). -863 863 ( ). -865 865 (). -7 8 7 . -b, --keep-bom (BOM). , . . ,,"-r"". -c, --convmode _ . _ : ascii, 7bit, iso, mac ,,ascii" . -D, --display-enc . : ansi, unicode, unicodebom, utf8, utf8bom ,,ansi" . ,,dos2unix" . , . . . ansi ,,dos2unix"- . . ,,TrueType" . ,,"chcp"", ,,dos2unix" . - . , . , . unicode, unicodebom ( -16) . . ,,TrueType" . ,,TrueType" , . ,,ConEmu" , ,,ConEmu" . - -. . ,,"unicodebom"" ( ). ,,PowerShell"-. utf8, utf8bom 8 -. ,,TrueType" . ,,TrueType" ,,"unicode"" . - . , . , . ,,ConEmu" 8 . ,,"utf8bom"" -8 ( ). ,,PowerShell"-. ,,DOS2UNIX_DISPLAY_ENC" ,,"unicode"", ,,"unicodebom"", ,,"utf8"", ,,"utf8bom"". -e, --add-eol . . . . , POSIX . . --error-binary . -f, --force . -gb, --gb18030 -16 -8, . -16 ,,GB18030". . ,,GB18030". -h, --help . -i[], --info[=] ... . . , : , , , , , . : 6 0 0 no_bom dos.txt 0 6 0 no_bom unix.txt 0 0 6 no_bom mac.txt 6 6 6 no_bom mixed.txt 50 0 0 UTF-16LE utf16le.txt 0 50 0 no_bom utf8unix.txt 50 0 0 UTF-8 utf8dos.txt 2 418 219 no_bom dos2unix.exe . ,,"-s"". "-e" "--add-eol" , "noeol" . : 6 0 0 no_bom dos dos.txt 0 6 0 no_bom unix unix.txt 0 0 6 no_bom mac mac.txt 1 0 0 no_bom noeol noeol_dos.txt . . 0 . ,,c". ,,xargs(1)" ,,-0" ,,"--null"". d . u . m . b . t . e , "noeol" . c . ,,"c"" ,,dos2unix" , ,,unix2dos" . "-e" "--add-eol" . h . p . : ,,*.txt" : dos2unix -i *.txt : dos2unix -idu *.txt : dos2unix --info=b *.txt : dos2unix -ic *.txt : unix2dos -ic *.txt : dos2unix -e -ic *.txt : dos2unix -ic0 *.txt | xargs -0 dos2unix : find -name '*.txt' -print0 | xargs -0 dos2unix -ic -k, --keepdate . -L, --license . -l, --newline . dos2unix: . . unix2dos: . . -m, --add-bom (BOM) . -8 . -16, ,,"-u"", -16 . ,,UTF-8", ,,UTF-16", ,,GB18030". . -n, --newfile _ _ ... . _ _. ,," ,," . () . / ,,umask(1)" . --no-allow-chown . / . ,,"-o"" ,,"-n"". ,,dos2unix" . --no-add-eol (). --no-error-binary (). -O, --to-stdout , . ,,-o" (). ,,-e" . , . : dos2unix -e -O 1.txt 2.txt > .txt -o, --oldfile ... . . . . ( ) , / . (. ). . . , . , / . ,,dos2unix" ,,"dos2unix -V"". . , . , . , / . / . ,,"--allow-chown"" : dos2unix --allow-chown foo.txt : dos2unix -n foo.txt foo.txt ,,"--allow-chown"" , . -q, --quiet . . . . -r, --remove-bom (BOM). . . ,,"-b"". -s, --safe (). . 100% . . . . , . "--error-binary", . -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". . ( -16 ) , -8 . ,,iconv(1)" -8 -16. . -16 ,,conversion mode". ,,ascii" -16 . -ub, --assume-utf16be ,,UTF-16BE". ,,"-ul"". -v, --verbose . . -F, --follow-symlink . -R, --replace-symlink ( ). -S, --skip-symlink (). -V, --version . DOS- Unix . Mac- . - . . ,,"-c mac"" ,,"mac2unix"" ,,"unix2mac"". ascii . ASCII ASCII- , UTF-8. ascii 7bit iso. dos2unix UTF-16 , UTF-16 POSIX UTF-8 . ascii UTF-16 ("-u") UTF-16 ("-ul" "-ub"). dos2unix UTF-16 "dos2unix -V". UNICODE. 7bit 8 - ( 128 255) 7 . iso ( ) -8859-1 (Latin-1) . -8859-1 , , . -8859-1 -. ,,"-iso"", ,,dos2unix" . , ,,dos2unix" 437, -. , ,,-437" (), ,,-850" (), ,,-860" (), ,,-863" ( ) ,,-865" (). 1252 () ,,-1252". ,,dos2unix" ,,iconv(1)". . . -8 . : Latin-1: dos2unix -iso -n .txt .txt CP850 Latin-1: dos2unix -850 -n .txt .txt CP1252 Latin-1: dos2unix -1252 -n .txt .txt CP1252 -8 (): iconv -f CP1252 -t UTF-8 .txt | dos2unix > .txt Latin-1 : unix2dos -iso -n .txt .txt Latin-1 CP850: unix2dos -850 -n .txt .txt Latin-1 CP1252: unix2dos -1252 -n .txt .txt -8 () CP1252: unix2dos < .txt | iconv -f UTF-8 -t CP1252 > .txt See also and . 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. DOS, Unix Mac , ASCII . ,,dos2unix"- ,,unix2do"- -8 , -8 -. 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". / -16 . ,,locale(1)" . , . -16 -8. -8 /. -16 -8 , . -16 -8, -16 , . ,,"-u"", -16 . ,,"-u"" -8. ,,dos2unix" ,,unix2dos" -8 -16. 7- -16 . (BOM), ( ) . . . . ,,dos2unix" -16 . -16 , ,,dos2unix" . ,,"-ul"" ,,"-ub"" -16 -. ,,dos2unix" . ,,"-b"" ,,dos2unix . ,,unix2dos" . ,,"-r"" . ,,dos2unix" ,,unix2dos" ,,"-m"" . ,,dos2unix" . ,,dos2unix" . ,,dos2unix" ,,"dos2unix -V"". . ,,"-D"", ,,"--display-enc"". , . -16 ( -) -8: dos2unix -n .txt .txt -16 ( -) -8: dos2unix -ul -n .txt .txt -8 -8 -: unix2dos -m -n .txt .txt -8 -16: unix2dos < .txt | iconv -f UTF-8 -t UTF-16 > .txt GB18030 GB18030 . GB18030 . . ,,GB18030" -, . -8, ,,GB18030" . ,,GB18030" 936, . / -16 ,,GB18030" ,,GB18030". . ,,"locale -a"" . ,,"-gb"" -16 ,,GB18030". ,,GB18030" , . ,,_" ,,_": dos2unix < .txt cat .txt | dos2unix ,,.txt". ,,.txt": dos2unix .txt .txt dos2unix -o .txt .txt ,,.txt" : dos2unix .txt ,,.txt" , ,,.txt" 7 : dos2unix .txt -c 7bit .txt dos2unix -c ascii .txt -c 7bit .txt dos2unix -ascii .txt -7 .txt ,,.txt" : dos2unix -c mac .txt mac2unix .txt ,,.txt" : unix2dos -c mac .txt unix2mac .txt ,,.txt" : dos2unix -k .txt dos2unix -k -o .txt ,,.txt" ,,.txt": dos2unix -n .txt .txt ,,.txt" ,,.txt", ,,.txt"- ,,.txt": dos2unix -k -n .txt .txt ,,.txt", ,,.txt" ,,.txt": dos2unix .txt -n .txt .txt dos2unix -o .txt -n .txt .txt ,,.txt" ,,.txt", ,,.txt", ,,.txt", ,,.txt" ,,.txt": dos2unix -n .txt .txt -o .txt .txt -n .txt .txt ,,find(1)" ,,xargs(1)" ,,dos2unix"- . ,,.txt" : find . -name '*.txt' -print0 |xargs -0 dos2unix ,,find(1)"- ,,"-print0"" ,,xargs(1)"- ,,-0" . . ,,find(1)" ,,"-exec"" : find . -name '*.txt' -exec dos2unix {} \; : for /R %G in (*.txt) do dos2unix "%G" ,,PowerShell"- ,,PowerShell"-: get-childitem -path . -filter '*.txt' -recurse | foreach-object {dos2unix $_.Fullname} ,,LANG". ,,LANG" . . , . : , . : export LANG=nl export LANG=nl_NL , export LANG=nl_BE , export LANG=es_ES , export LANG=es_MX , export LANG=en_US.iso88591 , , Latin-1 export LANG=en_GB.UTF-8 , , -8 : ,,locale(1)" . , . ,,dos2unix" . , : "LANGUAGE=nl:de". , ,,LANG" ( LC_ALL) ,,C", ,,LANGUAGE". : . DOS2UNIX_LOCALEDIR ,,DOS2UNIX_LOCALEDIR" ,,LOCALEDIR" . ,,LOCALEDIR" . - ,,"/usr/local/share/locale"". ,,--version" ,,LOCALEDIR" . ( ): export DOS2UNIX_LOCALEDIR=$HOME/share/locale , . . 1. , . - , (mac2unix) - , ( ) - , - () Project page: : file(1) find(1) iconv(1) locale(1) xargs(1) dos2unix 2026-08-27 dos2unix(1)