Check for line endings with od (also you can use other hex tools with -c option – which is the Printable Characters format)

od -c file
  • DOS: \r \n  (carriage return and a newline) CR LF
  • LINUX (and new MACs, Mac OS X, are POSIX-compliant): \n  (just a new line) LF
  • OLD MACS (Classic MACS): \r  (just a carraige return)  CR

Examples:

Lets look at this file thats 2 lines

-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQC

DOS EOL

# od -c *dos
0000000 - - - - - B E G I N R S A P
0000020 R I V A T E K E Y - - - - - \r
0000040 \n M I I C X Q I B A A K B g Q C

LINUX EOL

# od -c "/etc/lighttpd/lighttpd.pem"
0000000 - - - - - B E G I N R S A P
0000020 R I V A T E K E Y - - - - - \n
0000040 M I I C X Q I B A A K B g Q C

OLD MACS EOL

# od -c *mac
0000000 - - - - - B E G I N R S A P
0000020 R I V A T E K E Y - - - - - \r
0000040 M I I C X Q I B A A K B g Q C 2

The end

Leave a Reply

Your email address will not be published. Required fields are marked *