How to Transfer Text Files
Linux, Macintosh, and Microsoft Windows
Operating Systems

Text files are often incompatible across operating systems. Why? Because different operating systems use different markers to indicate the end of a line. This can really mess you up if you are trying to transfer files from one operating system to another.

The original Macintosh used a carriage return to end a line. A carriage return marking the end of a line is intuitive to anyone who is old enough to have ever used a typewriter. For those too young to know, an electric typewriter has a big key called a carriage return that automatically advances you to the next line.

Times have changed and Macintosh has too. The newer Macintosh computers are called Mac OS X. These new macs use a line feed instead of a carriage return to end a line.

What's the difference? The carriage return is often referred to by the capital letters CR. The line feed is often referred to by the capital letters LF.

On older Macs, every line has a CR at the end. On newer Macs, a LF does the same job.

Under Linux (a variant of Unix), the end of a line is indicated by a line feed. Every line ends with a line feed or LF. Linux lines use the same LF character that modern OS X Macs use.

In other words, Linux and modern OS X Macs end their lines with the same character, the LF. To cut down on confusion, think of OS X Macs and Linux as being interchangeable. They are interchangeable in terms of the end-of-line character.

Think of the classic Mac as being in a class all to itself. It is the only operating system in this article that ends its lines with a single CR.

Calling the end of a line a LF versus a CR is not just semantics. These are 2 very real characters with 2 very real and very separate numeric representations on a computer. A CR is a 13 on the ASCII table of characters and an LF is a 10 on the ASCII table of characters.

Contributing to the confusion is the fact that Microsoft Windows does things yet another way. Under Microsoft Windows, lines end with a combination of 2 characters -- a CR followed by a LF. Symbolically, this is represented as CRLF or carriage return, line feed.

Historical Perspective

Line feeds are separate characters from carriage returns for historical reasons. In the old days, the Associated Press used to send out press releases on a machine called a teletype. Today, teletype machines appear to us as very limited because they were electromechanical devices and not computers.

Teletypes were big. The size and nature of the old teletypes were such that you could hear these machines tap tap taping away in the background of old radio and television newscasts. It was a sound that gave the newscast a quality of immediacy and urgency. Today, newscasts mimic this same quality of immediacy and urgency with music that opens the show.

In any case, these machines had no brain, no microprocessor, built into them. They were dumb. Being dumb machines made it necessary to tell them every little thing. Every little thing includes doing carriage returns and linefeeds.

What is a carriage return? It is the print head of the teletype moving all the way to the left side of the paper. What is a line feed? It is the platen of the teletype advancing the paper one line. These are 2 separate and distinct functions.

On typewriters, these 2 separate and distinct functions were combined into one key -- the carriage return. This is why the enter key on a computer keyboard can represent a carriage return, a line feed, or both together -- it's for historical reasons.

Converting Text Files From One Operating System to Another

Converting a text file from one operating system to another is simple in principle:

To convert a Microsoft Windows file to Linux or a classic Macintosh file you subtract. For the conversion to a classic Macintosh, you subtract the LF of the CRLF combination. For the conversion to Linux (read Mac OS X, also), you subtract the other character -- the CR of the CRLF combination.

The reverse of subtraction is addition. To reverse direction and convert a Linux or classic Macintosh file to a Microsoft Windows text file, you add. For conversion from a classic Macintosh to Windows, you add a LF immediately following each CR. To convert a Linux file to a Windows file, you add a CR immediately before each LF.

Converting between the classic Macintosh and Linux is a matter of substitution rather than addition or subtraction. When going from Linux to the classic Mac, you substitute the LF for the CR.

Again, I'm treating Mac OS X and Linux the same for the purposes of this article. When you read one, read the other as well.

Going in the opposite direction you do just the opposite: When going from the classic Mac to Linux, you substitute the CR for the LF.

It's Not as Hard as It Sounds

For most folks, transferring files from one operating system to another is not as hard as it sounds. Most people use FTP to transfer their files. FTP automatically does the text file conversion for you.

FTP has two basic modes for transferring files: binary mode and ASCII mode. In ASCII mode (say ask-eee), the end-of-line characters are translated for you. In binary mode, the end-of-line characters are left as-is.

Just remember this: If you are transferring text files, you want FTP to be in ASCII mode. If you are transferring anything else -- photos, drawings, sound files, etc. -- you want FTP to be in binary mode -- otherwise, you will corrupt your files by translating files that need no translating.


There are really only two characters you need to remember when transferring text files from one operating system to another -- carriage returns and line feeds. The hard part is remembering which of these characters goes with which operating system.

There are three operating systems that make use of these 2 characters to mark the ends of lines in text files: Linux, classic Macintosh, and Microsoft Windows.

Again, I'm throwing Mac OS X in with Linus. If you are wondering what kind of Mac you have, it is in all probability a Mac OS X. This is the modern Mac, the one you would purchase today.

A classic Mac is something you would have purchased in the 1980s and 1990s.

Both Linux and classic Macintosh use a single character to mark the end of a line in a text file: In the case of Linux that character is a line feed. In the case of the classic Macintosh, that character is a carriage return.

Microsoft Windows uses both characters to mark the end of a line. The two-character combination is a carriage return followed by a line feed.

If you use FTP in ASCII mode, all text file conversions between different operating systems are taken care of for you.

©Edward Abbott, 2002-2010. All rights reserved. Revised January 20, 2010.

Questions or comments? Email me at

Directory of File Transfer Resources

How Do I Convert Between Unix and Mac OS

7 Reasons to Learn FTP and Learn It Well