The Linux Newbie Guide  ⇒    Fundamentals     Advanced     Supplement   Command Index   ENG⇒中
All rights reserved, please indicate the source when citing
  

unix2dos - Convert UNIX to DOS Format




The unix2dos command is used to convert text files from Unix/Linux line endings "\n" to DOS/Windows line endings "\r\n". This conversion is necessary because Unix and DOS/Windows define line endings differently, and opening a Unix/Linux formatted file in a DOS/Windows environment can result in formatting issues.

The basic syntax for the unix2dos command is as follows:
unix2dos [OPTIONS] [FILE...].

For example:
$ unix2dos UNIX_FILE

This command will convert the "UNIX_FILE" from Unix/Linux format to DOS format.

If you don't have the unix2dos command available, you can achieve the same conversion using tr:
$tr tr -d '\r' < UNIX_FILE > DOS_FILE

This command removes the carriage returns "\r" from the input file and saves it as "DOS_FILE", effectively converting it to DOS format.

For more detailed options and usage examples, you can refer to the provided link.