LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how can i remove this file "-gxxxx" (https://www.linuxquestions.org/questions/linux-newbie-8/how-can-i-remove-this-file-gxxxx-283596/)

zameer_india 01-29-2005 12:34 AM

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

jrtayloriv 01-29-2005 01:14 AM

rm -- -gxxx_file1

(remember to read those man/info pages)

jrtayloriv

rabeea 01-29-2005 01:44 AM

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 /-/

jrtayloriv 01-29-2005 01:55 AM

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

info rm

zameer_india 01-29-2005 01:56 AM

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

zameer_india 01-29-2005 02:21 AM

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

zameer_india 01-29-2005 02:25 AM

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


All times are GMT -5. The time now is 06:28 PM.