Recently I found that, after a uploading file from a Windows computer to a Linux one, and opened the file from the command line, Ubuntu would notify me that it was converting it from the DOS format.
Even if it was a standard text file (.txt) filled with ASCII characters, it still needed converting.
Why? Aren’t text files the same across different operating systems? Evidently not.
Unix handles end-of-line signifiers differently than Windows/DOS does, according to Sumitabha Das’s book “Your Unix”.
Specifically, DOS uses two different sets of characters, “\r” (for Carriage Return [CR], or simply “enter”) and “\n” (for Line Feed [LF]) to signify the end of a line.
Unix only uses one, namely LF
These markers can both be seen by examining text files with Octal Dump.
Ubuntu anyway seems to handle DOS text files easily in day to day operation. Nonetheless, most variants of Unix/Linux have a set of utilities to convert files from Windows/DOS into Unix, and back again. They are called dos2unix and unix2dos, respectively.
Taken from this book:
…as well as a class I’m taking on Unix. All mistakes are my own, however.–Joab Jackson