dos2unix(1) 2026-08-27 dos2unix(1) (NAME) dos2unix - DOS/Mac Unix (SYNOPSIS) dos2unix [options] [FILE ...] [-n INFILE OUTFILE ...] unix2dos [options] [FILE ...] [-n INFILE OUTFILE ...] (DESCRIPTION) dos2unix "dos2unix" "unix2dos" DOS Mac Unix . DOS/Windows (newline) : (CR) (LF). Unix : (LF). Mac Mac OS X (CR) . Mac OS Unix (LF) . dos2unix . (code page) Unix Latin-1 . (UTF-16) (UTF-8) . . (non-regular) FIFO . (symbolic links) . . . dos2unix dos2unix SunOS/Solaris . SunOS/Solaris : ( old file mode) SunOS/Solaris ( new file mode) . "-o" "-n" . SunOS/Solaris iso ascii . (OPTIONS) -- . (dash) . <<-foo>> : dos2unix -- -foo : dos2unix -n -- -foo out.txt --allow-chown . / . . "-o" "-n" . dos2unix . -ascii . << (CONVERSION MODES)>> . -iso DOS ISO-8859-1. << (CONVERSION MODES)>> . -1252 1252 ( ). -437 437 ( ). ISO . -850 850 ( ). -860 860 (). -863 863 ( ). -865 865 (). -7 8 7 . -b, --keep-bom (BOM). BOM BOM . DOS . "-r" . -c, --convmode CONVMODE . CONVMODE : ascii 7bit iso mac ascii . -D, --display-enc ENCODING . ENCODING : ansi unicode unicodebom utf8 utf8bom ansi . dos2unix . . . . ansi dos2unix ANSI . (backwards compatibility) . (raster) TrueType . "chcp" DOS OEM ANSI dos2unix . ansi . . unicode, unicodebom unicode ( UTF-16) . . TrueType . TrueType . ConEmu ConEmu . unicode ASCII . (redirect) . "unicodebom" BOM ( ) . BOM (piping) PowerShell ..IP "utf8, utf8bom" 4 utf8 ASCII . TrueType . TrueType "unicode" . (raster font) ASCII . . . ConEmu utf8 . "utf8bom" UTF-8 BOM ( Byte Order Mark) . (redirection) (piping) PowerShell BOM . DOS2UNIX_DISPLAY_ENC "unicode" "unicodebom" "utf8" "utf8bom" . -e, --add-eol . . DOS Unix . . Unix POSIX (newline) . (concatenation) . --error-binary . -f, --force . -gb, --gb18030 UTF-16 locale UTF-8 . UTF-16 GB18030 . . GB18030 . -h, --help . -i[FLAGS], --info[=FLAGS] FILE ... . . : DOS Unix Mac (BOM) . : 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 null . c . -0 "--null" xargs(1) . d DOS. u Unix. m Mac. b (BOM). t . e "noeol" . c . "c" dos2unix DOS unix2dos Unix . "-e" "--add-eol" . h . p . : *.txt: dos2unix -i *.txt DOS Unix: 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 . dos2unix: DOS Unix . Mac Mac Unix . unix2dos: Unix DOS . Mac Unix Mac . -m, --add-bom (BOM) . BOM UTF-8 . UTF-16 "-u" BOM UTF-16 . UTF-8 UTF-16 GB18030 . UNICODE ..IP "-n, --newfile INFILE OUTFILE ..." 4 . INFILE OUTFILE . (wildcard) . () . / umask(1) . --no-allow-chown (). / . "-o" "-n" . dos2unix . --no-add-eol (). --no-error-binary (). -O, --to-stdout Unix. ( in-place) "-o" . "-e" (concatenate) (BOM) . : dos2unix -e -O file1.txt file2.txt > output.txt -o, --oldfile FILE ... . FILE . . (wildcard) . ( in-place) / ( root). . . . / Unix . dos2unix "dos2unix -V" . . . . / . / . "--allow-chown" : dos2unix --allow-chown foo.txt : dos2unix -n foo.txt foo.txt "--allow-chown" . -q, --quiet . . . -r, --remove-bom (BOM). BOM . Unix . "-b" . -s, --safe (). . . . . . . "--error-binary" . -u, --keep-utf16 UTF-16 . UTF-16 ( little-endian big-endian) . UTF-8 . BOM UTF-16 . "-ascii" . -ul, --assume-utf16le UTF-16LE . (BOM) BOM . ( UTF-16LE ) UTF-8 . iconv(1) UTF-8 UTF-16LE . . UTF-16LE . ascii UTF-16LE . -ub, --assume-utf16be UTF-16BE . "-ul" . -v, --verbose (verbose). . -F, --follow-symlink . -R, --replace-symlink ( ). -S, --skip-symlink (). -V, --version ..SH " (MAC MODE)" DOS Unix . Mac . Mac Mac Unix . DOS . Mac "-c mac" "mac2unix" "unix2mac" . (CONVERSION MODES) ascii . ASCII ASCII UTF-8 . ascii 7bit iso . dos2unix UTF-16 UTF-16 POSIX locale UTF-8 . ascii UTF-16 ("-u") UTF-16 ("-ul" "-ub") . dos2unix UTF-16 "dos2unix -V" . UNICODE . 7bit ASCII ( ) . iso DOS ( ) ISO ISO-8859-1 (Latin-1) Unix . DOS ISO-8859-1 . ISO-8859-1 DOS . "-iso" dos2unix . dos2unix CP437 . -437 ( ) -850 ( ) -860 () -863 ( ) -865 () . CP1252 ( ) -1252 . dos2unix iconv(1) . Iconv . ISO UTF-8 . : DOS Latin-1 : dos2unix -iso -n in.txt out.txt DOS CP850 Latin-1 : dos2unix -850 -n in.txt out.txt Windows CP1252 Latin-1 : dos2unix -1252 -n in.txt out.txt Windows CP1252 UTF-8 (): iconv -f CP1252 -t UTF-8 in.txt | dos2unix > out.txt Latin-1 DOS: unix2dos -iso -n in.txt out.txt Latin-1 DOS CP850: unix2dos -850 -n in.txt out.txt Latin-1 Windows CP1252: unix2dos -1252 -n in.txt out.txt UTF-8 () Windows CP1252: unix2dos < in.txt | iconv -f UTF-8 -t CP1252 > out.txt : . (UNICODE) (Encodings) . Unix Linux UTF-8 . Windows UTF-8 UTF-16 UTF-16 big-endian UTF-16 . (Conversion) ASCII DOS Unix Mac . dos2unix unix2dos UTF-8 UTF-8 ASCII . dos2unix unix2dos Unicode UTF-16 UTF-16 little-endian big-endian . dos2unix UTF-16 "dos2unix -V" . Unix/Linux UTF-16 locale . locale locale(1) . . Windows UTF-16 UTF-8 . UTF-8 Windows Unix/Linux . UTF-16 UTF-8 . UTF-16 UTF-8 ( UTF-16 ) . "-u" UTF-16 . "-u" UTF-8 . dos2unix unix2dos UTF-8 UTF-16 . ISO 7-bit UTF-16 ..SS " (Byte Order Mark)" (BOM Byte Order Mark) ( Notepad) BOM . : . BOM . (locale character encoding) . dos2unix UTF-16 BOM . UTF-16 BOM dos2unix . UTF-16 BOM "-ul" "-ub" . dos2unix BOM . "-b" dos2unix BOM BOM . unix2dos BOM BOM . BOM "-r" . "-m" dos2unix unix2dos BOM . (Unicode file names on Windows) dos2unix Windows Command Prompt . dos2unix ANSI . dos2unix "dos2unix -V" . . "-D" "--display-enc" . . (Unicode examples) UTF-16 ( BOM) UTF-8 : dos2unix -n in.txt out.txt UTF-16LE ( BOM) UTF-8 : dos2unix -ul -n in.txt out.txt UTF-8 UTF-8 BOM: unix2dos -m -n in.txt out.txt UTF-8 UTF-16 : unix2dos < in.txt | iconv -f UTF-8 -t UTF-16 > out.txt GB18030 GB18030 . GB18030 . : . GB18030 . UTF-8 GB18030 ASCII . GB18030 GBK . / locale GB18030 UTF-16 GB18030 . . "locale -a" . UTF-16 GB18030 "-gb" . GB18030 (BOM) . (EXAMPLES) 'stdin' 'stdout': dos2unix < a.txt cat a.txt | dos2unix a.txt. b.txt: dos2unix a.txt b.txt dos2unix -o a.txt b.txt a.txt ascii: dos2unix a.txt a.txt ascii b.txt 7bit: dos2unix a.txt -c 7bit b.txt dos2unix -c ascii a.txt -c 7bit b.txt dos2unix -ascii a.txt -7 b.txt a.txt Mac Unix: dos2unix -c mac a.txt mac2unix a.txt a.txt Unix Mac: unix2dos -c mac a.txt unix2mac a.txt a.txt : dos2unix -k a.txt dos2unix -k -o a.txt a.txt e.txt: dos2unix -n a.txt e.txt a.txt e.txt e.txt a.txt: dos2unix -k -n a.txt e.txt a.txt b.txt e.txt: dos2unix a.txt -n b.txt e.txt dos2unix -o a.txt -n b.txt e.txt c.txt e.txt a.txt b.txt d.txt f.txt: dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt find(1) xargs(1) dos2unix . .txt : find . -name '*.txt' -print0 |xargs -0 dos2unix "-print0" find(1) xargs(1) -0 . . find(1) "-exec" : find . -name '*.txt' -exec dos2unix {} \; (Command Prompt) : for /R %G in (*.txt) do dos2unix "%G" Windows PowerShell : get-childitem -path . -filter '*.txt' -recurse | foreach-object {dos2unix $_.Fullname} (LOCALIZATION) LANG LANG . LANG . . (_) . : (character encoding) . POSIX: export LANG=nl Dutch export LANG=nl_NL Dutch, The Netherlands export LANG=nl_BE Dutch, Belgium export LANG=es_ES Spanish, Spain export LANG=es_MX Spanish, Mexico export LANG=en_US.iso88591 English, USA, Latin-1 encoding export LANG=en_GB.UTF-8 English, UK, UTF-8 encoding gettext : locale(1) locale . LANGUAGE LANGUAGE (:) . dos2unix LANGUAGE LANG . : "LANGUAGE=nl:de". LANGUAGE LANG ( LC_ALL) "C" . gettext : . DOS2UNIX_LOCALEDIR DOS2UNIX_LOCALEDIR LOCALEDIR . LOCALEDIR . "/usr/local/share/locale" . --version LOCALEDIR . ( POSIX): export DOS2UNIX_LOCALEDIR=$HOME/share/locale (RETURN VALUE) . . 1 . (quiet mode) . (STANDARDS) (AUTHORS) Benjamin Lin - Bernd Johannes Wuebben ( mac2unix) - Christian Wurll ( ) - Erwin Waterlander - () : : (SEE ALSO) file(1) find(1) iconv(1) locale(1) xargs(1) dos2unix 2026-08-27 dos2unix(1)