Changing line-endings from DOS-style (Windows) to Unix-style (Linux) the easy way with dos2unix

I’m always forgetting about the dos2unix utility.
Probably because I only need once every couple of years.


For the Ubuntu package, here’s the abbreviated apt-cache show dos2unix :

Description-en: convert text file line endings between CRLF and LF
This package contains utilities dos2unix, unix2dos, mac2unix,
unix2mac to convert the line endings of text files between UNIX (LF),
DOS (CRLF) and Mac (CR) formats.
Text files under Windows and DOS typically have two ASCII characters
at the end of each line: CR (carriage return) followed by LF (line
feed). Older Macs used just CR, while UNIX uses just LF. While most
modern editors can read all these formats, there may still be a need
to convert files between them.
This is the classic utility developed in 1989.

Leave a Reply

You must be logged in to post a comment.