Find the answer to your Linux question:
Results 1 to 3 of 3
Can anyone explain what the difference is between line feed and carriage return? I've seen some explanation, but what is the major difference between the two? How do they act ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Banned
    Join Date
    Jun 2009
    Posts
    68

    Question line feed / carriage return explanation


    Can anyone explain what the difference is between line feed and carriage return? I've seen some explanation, but what is the major difference between the two? How do they act differently?

  2. #2
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,252
    To understand LF and CR, you need to think back to the old days of typewriters. Imagine what happens when you read the end of a line. First, you must move the paper up to create a new line (Line Feed). Then you must move the carriage back to the beginning of the line (Carriage Return).

    This is the origin of these two characters. Obviously, they don't apply very much in the world of modern computing. We see them nowadays only in the "newline" character, which is how we represent the end of a line in a text file. On any *nix system, a newline is represented as a single LF character. On Windows, however, a newline is represented as a CR followed by an LF. This is why you have to somehow convert your text files when you transfer them from a Linux machine to a Windows machine or vice versa.

    Does this help at all?

  3. #3
    Banned
    Join Date
    Jun 2009
    Posts
    68
    Yes, that helps. I did read before that *nix is LF, Windows CR/LF, and Mac CR (don't know if that's changed.) I was thrown off by reading that a line feed is moving the paper up and carriage return is moving the paper up and moving to the left side. It's confusing to me what exactly happens that differentiates the two on a computer, considering they don't work the same as with a typewriter ... I've looked things up on it, but I haven't found a real description of how they behave on a computer that makes them different ...

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •