Table of Contents

Scripting - EOL

Some hints about the EOL characters on Windows and Linux.

Overview

Linux Windows
Written-out line feed carriage return and line feed
Short cut LF CRLF
Meta chars \n \r\n
ASCII-Code 0a 0d0a

Real life

Create files which contain only the EOL characters.

# printf "\n" > linux
# printf "\r\n" > win

Show hexdump of the files.

# xxd linux 
00000000: 0a                                       .
# xxd win 
00000000: 0d0a                                     ..

Let file classify the files.

# file linux 
linux: very short file (no magic)
# file win 
win: ASCII text, with CRLF line terminators

Look how GNU cat prints the EOL characters.

# cat -A linux 
$
# cat -A win 
^M$