Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-04-2009, 09:53 AM   #1
LQ Newbie
Registered: Jul 2009
Location: Canada
Distribution: Mint, Fedora, Ubuntu Server
Posts: 28

Rep: Reputation: 2
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!

Old 07-04-2009, 09:58 AM   #2
Wim Sturkenboom
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Read the man page of rm
To remove a file whose name starts with a ‘-’, for example ‘-foo’, use
one of these commands:

rm -- -foo

rm ./-foo

Last edited by Wim Sturkenboom; 07-04-2009 at 10:12 AM.
Old 07-04-2009, 10:13 AM   #3
Registered: Mar 2008
Location: Here - Where else?
Distribution: Fedora 12, Arch Linux (updated daily =D)
Posts: 270

Rep: Reputation: 31
it's a directory, I'm pretty sure that mean you need to use rm -r ./-q
Old 07-04-2009, 10:35 AM   #4
Registered: Dec 2008
Location: Bengaluru, India
Distribution: CentOS, openSUSE, Mandriva, Slackware
Posts: 111

Rep: Reputation: 19
Originally Posted by chickenlinux View Post
it's a directory, I'm pretty sure that mean you need to use rm -r ./-q
blingham wrote:
I have a file in my /home/<user> directory named -q.'s the only file in the directory,...

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

Last edited by saivin; 07-04-2009 at 10:37 AM.
Old 07-04-2009, 12:33 PM   #5
LQ Newbie
Registered: Jul 2009
Location: Canada
Distribution: Mint, Fedora, Ubuntu Server
Posts: 28

Original Poster
Rep: Reputation: 2
Originally Posted by Wim Sturkenboom View Post
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!



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
rotating apache logs.....looking for a good script to delete old log file ringding Linux - Server 6 04-25-2020 12:59 PM
Upload file to ftp server -vsftp- but can not delete or change the file once uploaded murattas6 Linux - Server 2 06-26-2009 06:00 AM
how to delete last number/word of a file and incude file count at the end of the chennaiguy Linux - Newbie 2 02-18-2008 09:08 PM
Please for the love of all that is good on this earth help me paul_mat Linux - Networking 4 06-23-2005 12:00 AM
Tried to delete file as root but it says I don't have permission to delete it! beejayzed Mandriva 23 03-12-2004 02:46 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:30 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration