LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   For the love of all that is good, help me delete this file! ;) (https://www.linuxquestions.org/questions/linux-newbie-8/for-the-love-of-all-that-is-good-help-me-delete-this-file-%3B-737705/)

blingham 07-04-2009 09:53 AM

For the love of all that is good, help me delete this file! ;)
 
Honestly, I've searched the forum, and maybe I'm not using the right search terms, but I can't find anything. I apologize if someone else finds it easily, but this is the biggest annoyance to me (and probably the smallest most insignificant thing to others lol)

I have a file in my /home/<user> directory named -q. I don't know why, and I don't know how.. probably a bad cp or mv command.

So, I'm sure you all know what the problem ends up being?

When I type rm -q... it tells me that -q is not a valid option for the rm command. I've tried everything that I can think of.. rm *q, rm '-q', rm * (it's the only file in the directory, there are other directories though.

Oh, and the kicker? This is Ubuntu Server, with no GUI installed ;)

Any help would be greatly appreciated!

Thanks,
Jay

Wim Sturkenboom 07-04-2009 09:58 AM

Read the man page of rm ;)
Quote:

To remove a file whose name starts with a ‘-’, for example ‘-foo’, use
one of these commands:

rm -- -foo

rm ./-foo


chickenlinux 07-04-2009 10:13 AM

it's a directory, I'm pretty sure that mean you need to use rm -r ./-q

saivin 07-04-2009 10:35 AM

Quote:

Originally Posted by chickenlinux (Post 3596566)
it's a directory, I'm pretty sure that mean you need to use rm -r ./-q

blingham wrote:
Quote:

I have a file in my /home/<user> directory named -q.
...it's the only file in the directory,...
:)

Both commands suggested by Wim work. Thanks to blingham and Wim, got to learn something interesting.

blingham 07-04-2009 12:33 PM

Quote:

Originally Posted by Wim Sturkenboom (Post 3596544)
Read the man page of rm ;)

Ok.. I feel dumb.. of all the places, I have to admit I didn't read the MAN page. Well, sorry for committing forums rule #1, which is obviously: "RTFM". ;)

But thank you so much!

Since it was a file, rm -- -q worked perfectly!

Jay


All times are GMT -5. The time now is 10:57 AM.