I'm new to Linux sorry if my question sounds dumb.
We know that Linux and Mac OS X use \n
(0xa), which is the ASCII line feed (LF) character. MS Windows and Internet protocols such as HTTP use the sequence \r\n
(0xd 0xa). If you create a file foo.txt in Windows and then view it in a Linux text editor, you’ll see an annoying ^M
at the end of each line, which is how Linux tools display the CR character.
Bu why Linux tools display the CR character as ^M
? as my understanding is, \r
(carriage return) is to move the cursor in the beginning of the current line, so the sensible approach to display it is like, when you open the file, you see the cursor is in the beginning of the line(that contains \r
), so ^M
shouldn't be displayed?
PS: some people post answers that how to remove ^M
, but I wnat to know why eventually^M
is displayed rather than moving the cursor in the beginning, which is the definition of carriage return.