Score:0

How to delete a file named -something with rm

cn flag

When I have a file named -19-5-20674., how can I delete that file?

When I use sudo rm:

$ sudo rm -19-5-20674.
rm: invalid option -- '1'
Try 'rm --help' for more information.

What can I do?

Score:1
tr flag

have a try withsudo rm ./-19-5-20674. or with sudo rm -- -19-5-20674.

your sudo reads the filename due to it's leading dash as an optional parameter / command option. most shells understand a double dash to signal end of command options. i circumvent this with a relative path as shown.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.