DATA RECOVERY UNION > Articles > Unix – What command do I need to use to remove a file called `-rf`?
Posted in

Unix – What command do I need to use to remove a file called `-rf`?

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

These just exit immediately, arrgh!

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

Solution:

unlink -rf

Or

rm -- -rf
๐Ÿ’ 

๐Ÿ”ต Best-selling hard drives, USB flash drives & SSDs everyone's buying.

Fast, reliable, and on sale now. Thousands pick these weekly โ€” don't miss Amazon's lowest storage prices.

โšก Top 10 Bestsellers
๐Ÿ† 4.7โ˜…+ Reviews
๐Ÿ“ฆ Prime Shipping
๐Ÿ‘‰ See today's best-selling Data storage on Amazon.com HDD ยท USB Flash Drives ยท SSD ยท External Drives
๐Ÿ›’
โœ… Updated hourly โ€” Amazon real-time ranking ๐Ÿ”ฅ Limited stock deals ๐Ÿ”— Affiliate
โญ Click to see complete best-selling list โญ