Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between DOS Format and MAC Format

When I save a file using nano on linux (bash), I get a message asking me to choose the format. There are two options: DOS Format and MAC Format. Can someone explain to me the difference between them?

like image 944
Alejandro Veintimilla Avatar asked Oct 19 '25 05:10

Alejandro Veintimilla


2 Answers

If you just press enter and no option, you save it in the same file-format which was detected. (That is the third option, and the option to prefer for Linux.)

If you selected an option you can deselect it again with pressing again "Alt" & "m" for deselecting [MAC-Format] or "Alt" & "d" for deselecting [DOS-Format]. If there is no option selected you use the UNIX-Format "line flyback" (LF or \n), which is most likely the format to prefer on Linux. The selected option is written just before the file name in the bottom.

see also: https://unix.stackexchange.com/questions/396551/gnu-nano-2-dos-format-or-mac-format-on-linux

like image 88
JoKalliauer Avatar answered Oct 22 '25 03:10

JoKalliauer


The difference is in the line endings:

  • dos: \r\n
  • *nix (including modern macs): \n
  • old macs (prior to OSX): \r
like image 42
Asaph Avatar answered Oct 22 '25 05:10

Asaph