Considering donating if you found my post helpful ๐

There is a file on my Ubuntu file system named -J
and I cannot remove it via command line.
A quick rm
command gave me this error
rm: invalid option -- 'J'
This is because symbol -
is used for defining options such as rm -r
or rm -f
. Running command rm -J
will literally execute rm
comamnd with option -J
.
The Fixes
There is 3 fixes available for you to try.
1. Append ./
at the front of the file name
$ rm ./-J
2. add --
after rm
$ rm -- -J
3. Use graphical interface. Access your Linux via Desktop and delete it from there by hitting DEL button or right-click and delete the file.
Considering donating if you found my post helpful ๐
