+3 votes
in Operating Systems by (71.8k points)

I have an image file that starts with a hyphen (-GFiZt0xnWY.jpg). When I run the command 'rm -f -GFiZt0xnWY.jpg' to delete this file, it gives the following error: rm: invalid option -- 'G'

How can I remove this file?

1 Answer

+1 vote
by (346k points)
selected by
 
Best answer

You can try one of the following commands to remove your file that starts with dash.

1. rm -- filename

rm -- -GFiZt0xnWY.jpg

2. rm ./filename

rm ./-GFiZt0xnWY.jpg


...