+2 votes
in Operating Systems by (20.3k 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

0 votes
by (48.8k points)

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