0

So I can install Ubuntu as a subsystem on Windows 10 and there is the location of all files. Everyone says "You can not edit files from windows gui".

I wonder exactly why?

Is it because windows use NTFS?

anything of these:?

Line breaks Windows uses CRLF (\r\n, 0D 0A) line endings while Unix just uses LF (\n, 0A).

Character Encoding Most modern (i.e., since 2004 or so) Unix-like systems make UTF-8 the default character encoding.

Windows, however, lacks native support for UTF-8. It internally works in UTF-16, and assumes that char-based strings are in a legacy code page. Fortunately, Notepad is capable of reading UTF-8 files; unfortunately, "ANSI" encoding is still the default.

Problematic Special Characters U+001A SUBSTITUTE Windows (rarely) uses Ctrl+Z as an end-of-file character. For example, if you type a file at the command prompt, it will be truncated at the first 1A byte.

On Unix, Ctrl+Z is nothing special.

U+FEFF ZERO WITH NO-BREAK SPACE (Byte-Order Mark) On Windows, UTF-8 files often start with a "byte order mark" EF BB BF to distinguish them from ANSI files.

On Linux, the BOM is discouraged because it breaks things like shebang lines in shell scripts. Plus, it'd be pointless to have a UTF-8 signature when UTF-8 is the default encoding anyway.

source: https://superuser.com/a/294280/517467

What are the options? Can I edit a file with some specific editor? Like Visual Studio Code?

  • meh. I see no point in maintaining two questions each for everything you can't do in WSL and the reason behind that. The dupe's accepted answer covers both. – muru Aug 04 '18 at 23:09

1 Answers1

2

It's all of the problems you've mentioned above. The CR/LF discrepancy and such and the other incompatibilities create errors that are often very cryptic to diagnose

Many editors do have support for detecting the right type of newline character, and Visual Studio Code as mentioned by you also has a switch on the status bar to switch beetween the two

No one really says "You can not edit files from the windows gui", it's always that it's not recommended as if you don't know what you're doing, you could cause more trouble than it's owrth

Amith KK
  • 13,412
  • If it's because of NTFS, I think Ubuntu can mount NTFS drive, so it would solve this issue. CR/LF is in many IDE options, so shouldn't be an issue either, what else? – Lukas Liesis Jul 24 '18 at 20:18
  • It's not about NTFS. NTFS cannot store any of the unix permissions, hence any file moved to a regular NTFS partition loses all it's Unix metadata. That however does not stop you from editing a text file in windows – Amith KK Jul 24 '18 at 20:26
  • So if i'm ok to lose unix permissions, i could just mount NTFS on subsystem and edit those files on windows? – Lukas Liesis Jul 24 '18 at 20:33
  • Seems like rsync can be a solution to this. this answer is about how to run it on subsystem https://serverfault.com/a/912234/334314 So file would be edited on windows and syncs to ubuntu. It's not direct edit so nothing braking anything but file eventually is on ubuntu side from windows. – Lukas Liesis Jul 24 '18 at 21:01