In addition to LF (Line Feed) and CRLF (Carriage Return + Line Feed), there are other line ending types used by different operating systems:
-
CR (Carriage Return):
- Representation:
\r - Usage: Used by classic Mac OS (prior to Mac OS X). A text file with CR line endings might look like:
Line 1\r Line 2\r Line 3\r
- Representation:
-
LF (Line Feed):
- Representation:
\n - Usage: Used by Unix and Linux systems, as well as modern macOS.
- Representation:
-
CRLF (Carriage Return + Line Feed):
- Representation:
\r\n - Usage: Used by Windows systems.
- Representation:
Summary of Line Ending Types
- Linux/Unix: LF (
\n) - Windows: CRLF (
\r\n) - Classic Mac OS: CR (
\r)
Understanding these line endings is important for ensuring compatibility when transferring files between different operating systems.
