GNU nano 2: DOS Format or Mac Format on Linux

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.


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>.)