File Separators: “\” or “/”
Every once in a while you run across directory structures or commands that require an understanding of an OS’s file system. Even the Web uses a file separator. It just happens to be that the Web and Mac/Linux use the forward slash character as the file separator and Windows uses the backslash character. This divergence causes a misunderstanding when trying to Google code fixes or just trying something new with your operating system.
Windows Uses the Backslash Character
Well, I know you are dying to find out why Windows is different from the Web and Linux-based operating systems regarding file separators. The simple explanation was when MS-DOS 1.0 arrived; it didn’t have any real support for a directory structure. The OS did use the “/“ character for a command line “switch” character. It follows that as MS-DOS improved, the “\” character was chosen to be the directory separator so that there was no conflict with the “switch” character. Notably, the backslash character was chosen because it most resembled the forward slash selected by Unix-based systems such as Linux or MacOS and the World Wide Web.
Even though MS-DOS grew into Windows, some original features of MS-DOS 1.0 remain. The backslash directory separator is one of them. It should be noted that in some areas of Windows, the OS corrects the directory path to use a forward slash (behind the scenes) when communicating with certain other systems.
Mac and Linux Use the Forward Slash Character
MacOS is a BSD Linux-based operating system. Linux is derived from the Unix operating system. Around 1970, Unix chose the “/“ character as its file system directory separator. Unlike MS-DOS or Windows, Unix-based systems use the “-“ as the “switch” operator and the backslash is used as an escape character.
The Web uses the forward slash character as a directory separator as well. You probably use this every day without knowing why. Every web browser, Android Phone, iOS device and other Internet Things use the forward slash.
Google Searches for Code Fixes
When the casual user searches Google or Bing for something they need to fix or modify on their computer system, they will usually run into a command line option. When you decide to use the command line option, make sure you understand what we have discussed. Very few articles or blog posts will give you commands for both Windows and Linux-based systems. But, not to worry because you already know how to modify a directory path according to the operating system. If you still have questions, you can go to [errorDetective.com] and click on the purple button to ask a question.
To understand how to access system files, you must know the file system separator. One way to remember which one to use is to look around for an example of a file path on the system you are using. Once you see it, you will remember that Windows uses "" as the file separator and "/" for the switch operator. Conversely, Unix-based systems use "/" as the file system separator and "-" for the switch operator.