1.1. The Filesystem

The filesystem is how your operating system organizes data to be stored and retrieved. A file has two key properties: a filename (usually written as one word) and a path. The path specifies the location of a file on the computer. For exam- ple, a file on my Windows 10 laptop has the filename project.docx in the path C::raw-latex:`\Users`:raw-latex:`\Al`:raw-latex:`\Documents`. The part of the filename after the last period is the file’s extension and tells you a file’s type. The filename project.docx is a Word docu- ment, and Users, Al, and Documents all refer to folders (also called ­ directories). Folders can contain files and other folders. For example, project.docx is in the Documents folder, which is in the Al folder, which is in the Users folder. Figure 2-1 shows this folder organization.

_images/2.png

Figure 2-1: A file in a hierarchy of folders

The C: part of the path is the root folder, which contains all other folders. On Windows, the root folder is named C: and is also called the C: drive. On macOS and Linux, the root folder is /. In this book, I’ll use the Windows- style root folder, C:. If you’re entering the interactive shell examples on macOS or Linux, enter / instead.

Additional volumes, such as a DVD drive or USB flash drive, will appear differently on different operating systems. On Windows, they appear as new, lettered root drives, such as D: or E:. On macOS, they appear as new folders within the /Volumes folder. On Linux, they appear as new folders within the /mnt (“mount”) folder. Note that folder names and filenames are not case sensitive on Windows and macOS, but they’re case sensitive on Linux.