nerdexam
LPI

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'.

Finding Your Way on a Linux System

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)
  • A
    2% (1)
  • B
    5% (3)
  • C
    2% (1)
  • D
    8% (5)
  • E
    84% (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'.

AFiles with extensions need a different treatment.

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.

Brm had to be called with the option -R to delete all files.

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.

CThe file Access.txt was probably opened by another application.

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.

DThe file Access.txt was hidden.

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.

ELinux file names are case sensitive.Correct

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

#case sensitivity#file names#Linux filesystem#rm command

Community Discussion

No community discussion yet for this question.

Full 010-100 Practice