010-100 · Question #80
While deleting all files beginning with the letter a there was still the file Access.txt left. Assuming that it had the correct ownership, why was it not deleted?
The correct answer is E. Linux file names are case sensitive. Linux file names are case sensitive, so a wildcard pattern like 'a*' matches only files starting with lowercase 'a' and does not match 'Access.txt' which begins with an uppercase 'A'.
Question
While deleting all files beginning with the letter a there was still the file Access.txt left. Assuming that it had the correct ownership, why was it not deleted?
Options
- AFiles with extensions need a different treatment.
- Brm had to be called with the option -R to delete all files.
- CThe file Access.txt was probably opened by another application.
- DThe file Access.txt was hidden.
- ELinux file names are case sensitive.
How the community answered
(64 responses)- A2% (1)
- B5% (3)
- C2% (1)
- D8% (5)
- E84% (54)
Why each option
Linux file names are case sensitive, so a wildcard pattern like 'a*' matches only files starting with lowercase 'a' and does not match 'Access.txt' which begins with an uppercase 'A'.
File extensions have no special significance in Linux for basic file operations like 'rm' - the extension does not require different syntax or flags to delete a file.
The '-R' or '-r' flag for 'rm' is used for recursive deletion of directories and their contents, not for matching files with different cases or extensions in a flat directory.
Unlike Windows, Linux does not lock files from deletion simply because they are open by another application - open files can still be unlinked from the directory while the process holds the file descriptor.
Hidden files in Linux begin with a dot (e.g., '.Access.txt') - 'Access.txt' does not start with a dot and is therefore not hidden.
Linux (and Unix-like) filesystems treat uppercase and lowercase letters as distinct characters in file names, so the glob pattern 'a*' only matches files whose names begin with the lowercase letter 'a', leaving 'Access.txt' (which begins with uppercase 'A') unaffected.
Concept tested: Linux case-sensitive file name matching with wildcards
Source: https://man7.org/linux/man-pages/man7/glob.7.html
Topics
Community Discussion
No community discussion yet for this question.