Why does Windows use \ and Linux use /? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Why does Windows use \ and Linux use /?

4th Nov 2020, 4:54 AM
Aria
Aria - avatar
14 Answers
+ 11
Thomas in order to find answer to this question, I had to dig down a bit in history of these operating systems, and here is what I found. Using "/" as directory seperator is an UNIX convention{ thus all UNIX-like OS including macOS and Linux use this} But microsoft-DOS had a problem, they already used the "/" as a "switch" character as earlier version of DOS was not having concept of directories, but when later version of DOS intorduced the support for directories they had to go for some other character as directory seperator { maybe to support backword compatibility with older DOS versions } so they went with "\". Now as Windows was initially built on top of DOS thus have to keep its lagacy of using "\" in file systems.
4th Nov 2020, 6:53 AM
Arsenic
Arsenic - avatar
+ 4
It comes from early DOS versions , which didn't have directories (after all they were created for microcomputers which had small storage space, generally provided by a floppy disk) so they didn't use a directory separator. They used character '/' to prefix command line switches. So when directories finally came they had to use a different separator. Later this convention was preserved in windows to keep (at least some) backwards compatibility. https://docs.microsoft.com/en-us/archive/blogs/larryosterman/why-is-the-dos-path-character
4th Nov 2020, 7:00 AM
Volodymyr Chelnokov
Volodymyr Chelnokov - avatar
+ 3
Arsenic and Volodymyr Chelnokov Ok that makes sense.
4th Nov 2020, 3:44 PM
Aria
Aria - avatar
+ 3
Thomas it wasn't Torvalds who chose / it was used much before in the Unix OS.
5th Nov 2020, 7:26 PM
Sonic
Sonic - avatar
+ 3
I believe Arsenic has the perfect answer.
5th Nov 2020, 7:26 PM
Sonic
Sonic - avatar
+ 2
Mikiyas I wasnt asking which was better; I was asking why Linux uses / and why windows uses \
4th Nov 2020, 5:21 AM
Aria
Aria - avatar
+ 2
Shail Murtaza I know that the creator can do what they want, but I want to know why Bill Gates chose \ and why Linus Torvalds chose /
4th Nov 2020, 5:22 AM
Aria
Aria - avatar
+ 2
Sonic Yeah I know it wasnt him I just couldnt remember who invented Unix lol
5th Nov 2020, 11:31 PM
Aria
Aria - avatar
+ 2
Thomas OK. Unix was invented in Bell labs by Ken Thompson, Dennis Ritchie and others.
6th Nov 2020, 1:55 AM
Sonic
Sonic - avatar
+ 1
You can also use / in Windows but you can't use \ in Linux. Linux and Windows are not the same OS and there creator are also not the same. Creator can do whatever he wants to do.
4th Nov 2020, 5:04 AM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar
+ 1
Thomas How I know?
4th Nov 2020, 5:23 AM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar
+ 1
Thomas According to me they doesn't worry about it more then you.
4th Nov 2020, 5:25 AM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar
+ 1
Shail Murtaza I didnt say you knew, I was just saying that I was asking that.
4th Nov 2020, 5:26 AM
Aria
Aria - avatar
+ 1
Sonic Oh ok
6th Nov 2020, 2:01 AM
Aria
Aria - avatar