Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nano 2.0.6 - Saving a file in Mac Format

Tags:

nano

Any ideas how to save a file edited with Nano, in "Mac format"? I keep getting DOS carriage returns in my newly-saved files on my Linux box. I provided a screen shot of the bottom menu when I go to "write out" file:

M-M Mac Format??? I see that there are save options when saving but cannot figure out how to execute them

enter image description here

M-M Toggle the use of Mac format

Thanks

like image 938
Slinky Avatar asked Nov 13 '12 20:11

Slinky


People also ask

How do you save a nano file on a Mac?

CTRL + O saves a Nano file. CTRL + X exits Nano.

Can you use nano on Mac?

If you want to use a graphical text editor, use TextEdit (in Launchpad). Otherwise, use one of the command-line editors included with macOS: Nano nano is a simple command-line editor. It's a good introduction to using a command-line editor because it includes easy-to-follow on-screen help.

How do I save a file after nano?

Close a file with the Ctrl+X key combination. If the file you are working on has been modified since the last time you saved it, you will be prompted to save the file first. Type y to save the file, or n to exit nano without saving the file.


2 Answers

The command "M-M" means "alt M". In fact, any command starting with "M" means the alt key. Some keyboards gobble up the alt key: in my case, on a Macbook Pro Retina, "esc" followed by "M" is what worked. More info here.

However, since your screenshot is showing [DOS Format] as the current selection, the key combination you really want is "alt D" (or "esc" followed by "D"). That will toggle off [DOS Format] so that you'll be saving your file with the default line-ending character (ASCII 0xA). Turning on [Mac Format] will just give you a new set of problems.

like image 122
Slinky Avatar answered Sep 29 '22 02:09

Slinky


Normally you neither want to save as DOS format nor in Mac format. On Linux you should prefer the Unix format, therfore:

  • enter a filename
  • press Enter

and the file will be saved with the default Unix line-endings (which is what you want on Linux):

https://unix.stackexchange.com/questions/396551/gnu-nano-2-dos-format-or-mac-format-on-linux?noredirect=1#comment707780_396551

like image 27
JoKalliauer Avatar answered Sep 29 '22 02:09

JoKalliauer