Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have (by mistake) created several files starting with a dash in my home directory. I can not select them nor delete them.

# ls -lht
-rw-r--r--  1 root  root  325 Mar 22 16:33 -s-vmstat-overall
-rw-r--r--  1 root  root 2.7K Mar 22 16:33 -s-vmstat
-rw-r--r--  1 root  root 8.4K Mar 22 16:32 -s-df
-rw-r--r--  1 root  root  29K Mar 22 16:32 -s-diskstats
-rw-r--r--  1 root  root  12K Mar 22 16:32 -s-interrupts
-rw-r--r--  1 root  root 9.7K Mar 22 16:32 -s-meminfo
-rw-r--r--  1 root  root 155K Mar 22 16:32 -s-mysqladmin
-rw-r--r--  1 root  root 203K Mar 22 16:32 -s-netstat
-rw-r--r--  1 root  root  37K Mar 22 16:32 -s-netstat_s
-rw-r--r--  1 root  root  766 Mar 22 16:32 -s-output
-rw-r--r--  1 root  root  11K Mar 22 16:32 -s-procstat
-rw-r--r--  1 root  root  13K Mar 22 16:32 -s-procvmstat
-rw-r--r--  1 root  root 175K Mar 22 16:32 -s-slabinfo

How to remove all such files starting with -s-

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted
rm ./-s-*

Isn't this a FAQ yet? Should it perhaps be one, if not?

share|improve this answer
add comment

Unix commands use the - prefix to indicate options; use the -- "option" to stop option processing, or prefix filenames with ./ (or an absolute path).

rm -- -s-df
rm ./-s-vmstat

You might want to look up an introduction to the Unix/Linux command line environment, as this is a FAQ.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.