by mistake i created the file like " ; "

i tried to remove this file using the below syntax ,

rm -f ;

but file still not deleted,

what i do now

link|improve this question

0% accept rate
feedback

migrated from stackoverflow.com Jan 11 '11 at 7:44

This question came from our site for professional and enthusiast programmers.

5 Answers

You have to quote the name:

rm -f ';'
link|improve this answer
feedback

Probably the same way you made it:

rm ';'
link|improve this answer
feedback

For bash shell you can use the following

rm -f \;
link|improve this answer
feedback

Everyone's answers will work to remove the file. The reason you could not delete it is because using a semicolon in the terminal generally signifies the end of the command.

Another trick for files like this is to delete by inode number. You can find the inode number next to your file by running:

ls -il

Now use the inode number in this syntax:

find . -inum 123456 -delete

Replace 123456 with the appropriate inode number.

link|improve this answer
feedback

This should work with nearly every weird name:

rm -- ';'
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.