Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to delete a file beginning with a "-"?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Judge584
Tux's lil' helper
Tux's lil' helper


Joined: 18 Apr 2005
Posts: 109

PostPosted: Fri Jan 09, 2009 8:56 am    Post subject: How to delete a file beginning with a "-"? Reply with quote

Hi,

Someone have created a file named "-toto" on a production server.

I want to delete this file, but the "-" is giving me troubles.

How to delete such files beginning with special character?

Many thanks...
Back to top
View user's profile Send private message
Veldrin
Veteran
Veteran


Joined: 27 Jul 2004
Posts: 1945
Location: Zurich, Switzerland

PostPosted: Fri Jan 09, 2009 8:59 am    Post subject: Reply with quote

Code:
rm \-toto
Back to top
View user's profile Send private message
pholthau
Guru
Guru


Joined: 27 Nov 2005
Posts: 361
Location: Bielefeld, Germany

PostPosted: Fri Jan 09, 2009 9:05 am    Post subject: Reply with quote

or
Code:

rm ./-blabla

or
Code:

rm -- -blabla

_________________
The message is Feierei, alder! The message is Gude Laune, alder! [Sven]
Back to top
View user's profile Send private message
Judge584
Tux's lil' helper
Tux's lil' helper


Joined: 18 Apr 2005
Posts: 109

PostPosted: Fri Jan 09, 2009 9:09 am    Post subject: Reply with quote

Many thanks!

I beleive the pholthau answer is the good one, because the two answers works.

Veldrin:

Thanks, but I'm not sure it works...because if i do a:

ls \-toto, the it list my entire directory instead of the file.
Back to top
View user's profile Send private message
Veldrin
Veteran
Veteran


Joined: 27 Jul 2004
Posts: 1945
Location: Zurich, Switzerland

PostPosted: Fri Jan 09, 2009 9:22 am    Post subject: Reply with quote

sry for the confusion. I though it worked...

*notes how to delete file with a leading dash*
Back to top
View user's profile Send private message
Judge584
Tux's lil' helper
Tux's lil' helper


Joined: 18 Apr 2005
Posts: 109

PostPosted: Fri Jan 09, 2009 1:42 pm    Post subject: Reply with quote

Don't be!

Many thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum