Unix2dos: Converts Linux And Macintosh Files To Windows Format
The
1 | unix2dos |
utility is part of the
1 | tofrodos |
software package; give the command
1 | sudo aptitude install tofrodos |
to install the package. Gibe the following command to convert a file named memo.txt (created with a text editor) to a DOS-format file:
$ unix2dos memo.txt
Without any options unix2dos overwrites the original file. You can now email the file as an attachment to someone on a Windows or Mac system. Similarly, you can use
$ dos2unix memo.txt
You can also use
1 | tr |
to change a Windows or Mac text file into a Linux text file. In the following example, the
1 | -d |
option causes
1 | tr |
to remove
1 | RETURN |
s (represented by
1 | \r |
) as it makes a copy of the file:
$ cat memo | tr -d ‘\r’ > memo.txt
the greater than (
1 | > |
) symbol redirects the standard output of
1 | tr |
to the file named memo.txt.

