EX200 Essential Tools Practice Question
A user is unable to delete a file named '-f' in the current directory. Which command will successfully remove it?
⚠ Common exam trap
A common mix-up: candidates assume quoting or escaping the dash will prevent option parsing, but only the '--' separator reliably tells rm to stop interpreting arguments as options.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
rm -- -f
The '--' double dash signals the end of command options to most Linux utilities, including rm. This allows rm to interpret '-f' as a literal filename rather than the '--force' option, enabling its deletion.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
rm \-f
Why it's wrong here
In `rm \-f`, the backslash is a shell quoting character that escapes the hyphen, so the command receives the single argument `-f`. However, the shell's backslash handling only affects how the word is passed to the program; rm itself still sees an argument with a leading dash and parses `-f` as its force option. Escaping the dash may make the shell leave the argument intact, but it does not tell rm to stop option parsing or to treat the argument as a filename.
- ✓
rm -- -f
Why this is correct
The command `rm -- -f` uses the standard end-of-options delimiter `--`, which POSIX utilities use to signal that no more options follow. When rm encounters `--`, it stops option processing and treats every subsequent argument literally as an operand, so `-f` becomes a filename. This is the correct way to delete a file whose name begins with a dash, because the argument is never interpreted as the force flag.
- ✗
rm -f
Why it's wrong here
In `rm -f`, the token `-f` is parsed by rm's option processor as the force flag, not as a file name. The command supplies no operand at all, so rm has nothing to delete; the intent to target a file literally named `-f` is lost because the leading dash is interpreted as an option marker. Without a `--` separator, any argument starting with `-` is treated as an option, and a bare `-f` cannot name a file.
- ✗
rm "-f"
Why it's wrong here
With `rm "-f"`, the double quotes group the hyphen and letter `f` into one shell word, but the shell's quote removal simply passes the resulting two-character string `-f` to rm. Quotes are processed by the shell before the program runs; rm cares only that the resulting argument begins with `-`, so it is dispatched to the option parser and interpreted as force. Quoting cannot emulate `--` because it has no effect on how the receiving program classifies the argument.
Go deeper
Related to this question
About these practice questions
One of 427 original EX200 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This EX200 practice question is part of Courseiva's free Red Hat certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the EX200 exam.