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


2 Answers 2


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]:


File Name to Write [Mac Format]:

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


Unix, Linux, new macOS \n DOS, Windows \r\n old Mac OS \r

Save in DOS Format, then cd to the folder where you have the file and perform:

cp -i ./<file> /home/petr/Documents/whatIfBackups/<file> to back it up and then re-format from the dos to unix line endings:

sudo dos2unix <file>

(file <file> shows the status of line endings. "ASCII text" stands for Unix/Linux/new macOS. Alternatively you could also save in Mac Format and then re format by sudo mac2unix <file>.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .