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 rmcommand 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 rmcomamnd 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 😊