file systems files directories Flashcards
https://www.francogarcia.com/en/blog/file-systems-files-folders-and-paths/
What is an absolute path?
A unique path that starts from the root of a file system and ends at the chosen destination (file or directory).
How do absolute paths differ between Windows and Unix-based systems?
- Windows: Starts with a drive letter (e.g., C:). Uses backslashes ().
- Unix: Starts with a forward slash (/). Uses forward slashes (/).
What is the root of a file system in Windows?
The root is a drive letter followed by a colon and backslash, such as C:.
What is the root of a file system in Unix-based systems?
It is represented by a single forward slash (/).
How does Windows handle case sensitivity in file paths?
Windows is not case-sensitive. For example, abc.txt and ABC.TXT refer to the same file.
How does Unix handle case sensitivity in file paths?
Unix-based systems are case-sensitive. For example, abc.txt and ABC.TXT are different files.
Why do Windows paths use backslashes?
Backslashes are inherited from DOS, where forward slashes were used for command-line parameters.
What is a tilde (~) in Unix-based systems?
A shorthand for the current user’s home directory.
Why is it recommended to avoid spaces and special characters in file names?
To minimise problems with command-line tools and programming libraries that assume simpler naming conventions.
What is a relative path?
A path that starts from an arbitrary origin instead of the root of the file system.
What does the dot (.) represent in relative paths?
The current directory.
What do two dots (..) represent in relative paths?
The parent directory of the current directory.
How do relative paths differ from absolute paths?
Relative paths depend on the current working directory, while absolute paths do not.
What is the working directory?
The directory currently assumed as the origin for relative paths.
How can you retrieve the working directory on Unix?
By using the $PWD environment variable.
How can you retrieve the working directory on Windows?
By using the ‘cd’ command.
What is encoding?
The process of converting a value to a code, such as text to binary.
What is decoding?
The process of converting a code back into its original value.
What is transcoding?
Encoding followed by decoding.
How is the character ‘a’ represented in binary using UTF-8?
As 1100001 (binary) or 97 (decimal).
What does the ord() function in Python do?
Returns the Unicode code point of a character.
What are the three main ways a computer determines which program to use to open a file?
- A person manually chooses the program.
- By recognising the file’s extension.
- By reading metadata stored in the file’s header.
What is a file extension?
A sequence of characters appended to a file’s name, usually after a dot, indicating the file’s format.
Are file extensions mandatory?
No, a file can exist without an extension, but it still retains its type based on its data format.
How do extensions help an operating system?
Extensions act as a heuristic, providing a tip about the file type and helping the operating system select an appropriate program to open it.
What is metadata in the context of files?
Information stored in the file’s header, often at the beginning, describing the file’s contents and format.
What does a computer do when it cannot determine how to open a file?
It may attempt to guess the file’s format by analysing its contents or ask the user to select a program.