unix2dos
unix2dos is a command-line utility used to convert text files from Unix-style line endings (LF) to DOS/Windows-style line endings (CRLF). It is commonly bundled in the dos2unix package, which also includes dos2unix, a utility that performs the reverse conversion. The tools are used to ensure correct newline handling when text files are exchanged between Unix-like systems and Windows.
When invoked on one or more files, unix2dos replaces the Unix newline characters in those files with
- unix2dos myfile.txt converts in place.
- unix2dos -n old.txt new.txt writes the converted data to new.txt without altering old.txt.
Availability and licensing: unix2dos and the dos2unix package are widely available on Linux, BSD, macOS, and
Relation: The counterpart is dos2unix, which converts DOS/Windows CRLF back to Unix LF; together they form a
---