Linux – GNU nano 2: DOS Format or Mac Format on Linux

file formatlinuxmacintoshnano

Which format (Mac or DOS) should I use on Linux PCs/Clusters?

I know the difference:

  • DOS format uses "carriage return" (CR or \r) then "line feed" (LF or \n).
  • Mac format uses "carriage return" (CR or \r)
  • Unix uses "line feed" (LF or \n)

I also know how to select the option:

  • AltM for Mac format
  • AltD for DOS format

But there is no UNIX format.

Then save the file with Enter.

enter image description here

Best Answer

Use neither: enter a filename and press Enter, and the file will be saved with the default Unix line-endings (which is what you want on Linux).

If nano tells you it’s going to use DOS or Mac format (which happens if it loaded a file in DOS or Mac format), i.e. you see

File Name to Write [DOS Format]:

or

File Name to Write [Mac Format]:

press AltD or AltM respectively to deselect DOS or Mac format, which effectively selects the default Unix format.

Related Question