Removing Files Starting with "-" in Linux

  • Thread starter Thread starter karthik3k
  • Start date Start date
  • Tags Tags
    Linux
AI Thread Summary
The Linux `rm` command is used to remove files, but special considerations are needed when dealing with files that start with a hyphen ("-"). To remove such files, the command `rm -- -file1.txt` can be used, where the double hyphen (`--`) indicates the end of command options. Alternatively, using a wildcard like `rm -- -*.txt` can also work for multiple files. It's recommended to consult the man pages for detailed command options and usage by typing `man rm` in the terminal.
karthik3k
Messages
149
Reaction score
0
LINUX rm command ?

How do i remove files starting with "-"

-file1.txt
-data.txt

rm -file1.txt
cant find a option -file1.txt


?
 
Computer science news on Phys.org
rm -- -file1.txt or
rm -- -*.txt

use the man pages whenever you can't find an option. It is usually explained there. To see the man page for a command type man <command_name>, i.e. man rm
 
Sorry if 'Profile Badge' is not the correct term. I have an MS 365 subscription and I've noticed on my Word documents the small circle with my initials in it is sometimes different in colour document to document (it's the circle at the top right of the doc, that, when you hover over it it tells you you're signed in; if you click on it you get a bit more info). Last night I had four docs with a red circle, one with blue. When I closed the blue and opened it again it was red. Today I have 3...
Thread 'ChatGPT Examples, Good and Bad'
I've been experimenting with ChatGPT. Some results are good, some very very bad. I think examples can help expose the properties of this AI. Maybe you can post some of your favorite examples and tell us what they reveal about the properties of this AI. (I had problems with copy/paste of text and formatting, so I'm posting my examples as screen shots. That is a promising start. :smile: But then I provided values V=1, R1=1, R2=2, R3=3 and asked for the value of I. At first, it said...
Back
Top