LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

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!

Thanks,
Jay
 
Old 07-04-2009, 10:58 AM   #2
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
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

Last edited by Wim Sturkenboom; 07-04-2009 at 11:12 AM.
 
Old 07-04-2009, 11:13 AM   #3
chickenlinux
Member
 
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, 11:35 AM   #4
saivin
Member
 
Registered: Dec 2008
Location: Bengaluru, India
Distribution: CentOS, openSUSE, Mandriva, Slackware
Posts: 111

Rep: Reputation: 19
Quote:
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:
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.

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

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

Jay
 
  


Reply


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
Upload file to ftp server -vsftp- but can not delete or change the file once uploaded murattas6 Linux - Server 2 06-26-2009 07:00 AM
rotating apache logs.....looking for a good script to delete old log file ringding Linux - Server 3 04-01-2009 11:57 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 10:08 PM
Please for the love of all that is good on this earth help me paul_mat Linux - Networking 4 06-23-2005 01: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 03:46 AM


All times are GMT -5. The time now is 04:31 PM.

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