Removing file named -rf in Unix –
This page looks best with JavaScript enabled

Removing file named -rf in Unix

 ·   ·  ☕ 1 min read  ·  ✍️ Sathyajith Bhat · 👀... views

I did something crazy at some point that created a file called “-rf” on my filesystem. Now I can’t figure out how to delete it.

I’ve tried:

rm "-rf"

rm -rf

But these just exit immediately. Arrgh!

Anyone know how to remove this file? Preferably without accidentally cleaning out my whole folder.

heh. What’re the odds, eh?

via Removing “-rf” file in Unix - Super User.

Share on

Sathyajith Bhat
Sathyajith Bhat
Author, AWS Container Hero and DevOps Specialist

What's on this Page