Bird
0
0

What will happen when you execute rm -i fileA.txt fileB.txt if fileA.txt exists but fileB.txt does not?

medium📝 Command Output Q4 of 15
Linux CLI - File and Directory Operations
What will happen when you execute rm -i fileA.txt fileB.txt if fileA.txt exists but fileB.txt does not?
ADelete both files without any prompt
BDelete <code>fileA.txt</code> without prompt and ignore <code>fileB.txt</code>
CShow error for both files without deleting anything
DPrompt for <code>fileA.txt</code> deletion, then show error for <code>fileB.txt</code>
Step-by-Step Solution
Solution:
  1. Step 1: Behavior of rm -i

    The -i option prompts before deleting each existing file.
  2. Step 2: Handling non-existent files

    If a file does not exist, rm will display an error message for that file.
  3. Step 3: Applying to given files

    Since fileA.txt exists, it will prompt for deletion. For fileB.txt, it will show an error as it does not exist.
  4. Final Answer:

    Prompt for fileA.txt deletion, then error for fileB.txt -> Option D
  5. Quick Check:

    -i prompts only for existing files; errors shown for missing files [OK]
Quick Trick: rm -i prompts only for existing files, errors for missing [OK]
Common Mistakes:
MISTAKES
  • Assuming no prompt with -i option
  • Expecting silent ignore of missing files
  • Thinking -i deletes without confirmation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes