LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 01-29-2005, 12:34 AM   #1
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Rep: Reputation: 30
how can i remove this file "-gxxxx"


Hi...All...

I create a file named "-gxxx_file1"using touch command as follows

touch /xxxx_dir/ -gxxx_file1 " - (hyphen) is used in starting of the file name"

now i would like to remove this file ("-gxxx_file1") using rm command... when i am trying to remove this file then i got a message like "invalid option -g" just as follows ...

rm -f -gxxx_file1 then i got the message a like "rm: invalid option -- g"

any help would be appreciated... thnx in advance....

zameer ahmed syed
 
Old 01-29-2005, 01:14 AM   #2
jrtayloriv
Member
 
Registered: Jun 2004
Location: Inland NW, US
Distribution: Ubuntu
Posts: 366
Blog Entries: 1

Rep: Reputation: 44
rm -- -gxxx_file1

(remember to read those man/info pages)

jrtayloriv

Last edited by jrtayloriv; 01-29-2005 at 01:15 AM.
 
Old 01-29-2005, 01:44 AM   #3
rabeea
Member
 
Registered: Aug 2004
Location: Pakistan
Posts: 52

Rep: Reputation: 15
hi,

wat i remember is that linux/unix only allow creating files starting with (0-9,a-z,_). Any file created other than this needs special treatment.
U somehow managed to create this file it will only allow u to delete if u write it in the following syntax
rm -f \-gxxx_file1

bcoz wat i did was i tried creating a file named "abc.
but unic didnt allowed me doing that.
then i gave the command
touch \"abc
and it created the file for me.
and when i tried removing i used the \ again and it worked.
try doing that

regards
Rabeea

try using
rm -f /-/
 
Old 01-29-2005, 01:55 AM   #4
jrtayloriv
Member
 
Registered: Jun 2004
Location: Inland NW, US
Distribution: Ubuntu
Posts: 366
Blog Entries: 1

Rep: Reputation: 44
the"rm -- -filename" is what he needs, otherwise it tries to pass the filename as an option.

info rm
 
Old 01-29-2005, 01:56 AM   #5
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Original Poster
Rep: Reputation: 30
Hi...
Thanx for Ur kind reply....

actually i created a file using this command
touch /somepath/-gxxx_file1 >>>> without any path we can't create a file start with
hyphen using touch / cat/... commands

for ex ..

i logged as a root
[root@redhat root]#
in this i have a directory name zameer12
from the terminal i used this command to create a file with prefix hyphen(-)

[root@redhat root] touch zameer12/-gxxx_file1

the above command creates a file in zameer12 directory which is in root directory... now i am not able to remove this file with the option u specified also so far... i got the same message with ur option also...

thnx...

zameer
 
Old 01-29-2005, 02:21 AM   #6
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Original Poster
Rep: Reputation: 30
yah i am able to delete this file ... the way in which i created ...in the same way i deleted this file....just like..

[root@redhat root]# rm zameer12/-gxxx_file1

thanx for all users...

zameer
 
Old 01-29-2005, 02:25 AM   #7
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Original Poster
Rep: Reputation: 30
especially thanx to rabeea
she gives me an idea ... that creation and deletion in a same way/manner will be a good one... i followed that rule and got it .....


zameer
 
  


Reply



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
how to remove the file "-rf"? codec Linux - Software 6 03-12-2005 12:03 PM
remove a file that has a " | " in it's name disorderly Linux - Security 3 09-27-2004 01:24 PM
remove "-" (dash) from file aurelio26 Linux - Newbie 4 09-16-2004 11:32 AM
How to remove a file called: "-be" zepplin611 AIX 7 08-21-2004 03:37 PM
remove "special" text out of a file tearinox Linux - General 1 03-15-2004 08:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:11 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
Open Source Consulting | Domain Registration