Multiple choice technology operating systems

I have a file named "-p" in my home directory. Which of the following commands will be used to delete this file?

  1. rm -p

  2. rm -f -p

  3. rm -f -- -p

  4. rm -f "-p"

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

A filename beginning with a hyphen must be separated from option parsing. Using rm -f -- -p tells rm that everything after -- is a filename, reliably deleting the file. The other forms either treat -p as an option or misuse quoting.