Line endings

Updated: 13 August 2023

\r\n DOS / Windows – carriage return + line feed.
CRLF DOS / Windows – carriage return + line feed.

\n Unix – line feed.
LF Unix – line feed.

dos2unix

A program that converts plain text files in DOS/MAC format to UNIX format.

Recursively find all files in current directory and run dos2unix on each

find . -type f -exec dos2unix {} \;

unix2dos

A program that converts text files in UNIX format to DOS format.

Convert and replace a.txt. Convert and replace b.txt.

unix2dos a.txt b.txt