filenames that begin with "-"

here's a dumb question:

I have a filename that begins with a "-", like "-xyz".
I can see it with ls -la

However, I can't figure out how to remove it.
Every tool like "rm", "mv", interpret the - as a command line argument and error out.

I've tried:

rm -xyz
rm "-xyz"
rm '-xyz'
rm ?xyz
rm *xyz
rm \-xyz
rm "\-xyz"

nothing works.  My shell is tcsh if that matters.
red5Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
vinnyd79Connect With a Mentor Commented:
no,
actually you have to hide the file name from the command

rm ./-xyz
0
 
vinnyd79Commented:

Is it in a directory with alot of files in it?If not you can try rm -ir and say no to all files except that one.
0
 
red5Author Commented:
there are a lot of files.

there must be a better way.

(I was able to delete it using ftp, but that was hack - I'm just curious now...)
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
vinnyd79Commented:

I think rm -f -xyz might do it.
0
 
red5Author Commented:
there are a lot of files.

there must be a better way.

(I was able to delete it using ftp, but that was hack - I'm just curious now...)
0
 
red5Author Commented:
ya, that's it.
0
 
vinnyd79Commented:
red5
did you try  this ? It will remove the file

 rm ./-xyz      
0
 
red5Author Commented:
ya, sorry, I had a double submit on accident...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.