Friday, May 10, 2024
14
rated 0 times [  14] [ 0]  / answers: 1 / hits: 1363  / 3 Years ago, sat, may 22, 2021, 9:16:51

While using grep with -oG flag I accidentally create a file named -v.



-rw-rw-r-- 1 username username 334 Feb 10 14:29 -v



Now I cannot figure out how to get rid of it.



I've tried:



rm -v
rm "-v"
rm '-v'
rm -f "-v"
rm -v


This is on a server so I only have the command line.
How do I remove this file?


More From » command-line

 Answers
6

The "--" argument to mv surely works (it means: "stop to interpreting strings starting with - as options from now on"), but it is worth to know also



rm ./-v 


which will work also with commands that do not have the "--" flag.



EDIT: well-behaved commands should respect the -- flag. But you never know.


[#27066] Monday, May 24, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aslity

Total Points: 336
Total Questions: 133
Total Answers: 98

Location: Zimbabwe
Member since Thu, Jul 21, 2022
2 Years ago
aslity questions
Sat, Apr 22, 23, 23:22, 1 Year ago
Wed, Oct 27, 21, 06:19, 3 Years ago
Sun, Oct 3, 21, 05:33, 3 Years ago
Fri, Jul 1, 22, 17:16, 2 Years ago
;