Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I've somehow managed to create a file with the name "--help". If I try to remove the file using "rm" funny stuff happens. Please help

here's a printout of the dir listing:

[pavel@localhost test]$ ls -la
total 3640
drwxrwxr-x.  5 pavel pavel    4096 Jun 19 18:33 .
drwxrwxr-x.  6 pavel pavel    4096 Jun  9 12:23 ..
-rw-rw-r--.  1 pavel pavel 1070592 Jun 12 09:40 --help
share|improve this question

migrated from serverfault.com Jun 20 '13 at 11:38

This question came from our site for system and network administrators.

marked as duplicate by Anthon, manatwork, slm, uther, Stéphane Gimenez Jun 20 '13 at 14:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3  
Humor bonus for "please help". –  tripleee Jun 20 '13 at 12:16

3 Answers 3

up vote 11 down vote accepted

Either

rm ./--help

or

rm -- '--help'

See Utility Syntax Guideline 10 in the POSIX.1-2008 specification for a description of the end-of-options indicator, --

share|improve this answer
2  
Prefer the first one, please. '--' will not be understood by some commands (and even some old versions of rm !) –  Olivier Dulac Jun 20 '13 at 9:27

Can you do...?:

ls -il
find . -inum [NUMBER] -exec rm -i {} \;

Super stolen from Squeezy.

share|improve this answer
1  
That's overkill. Just use -- to set end-of-options. –  ott-- Jun 20 '13 at 13:18
#!/usr/bin/env python

import os
os.unlink("--help")

Or you can do it interactively.

share|improve this answer
3  
you could actually do it directly from command line: python -c "import os; os.unlink('--help')" –  tutuDajuju Jun 20 '13 at 7:30

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