Unix delete or rename a file starting with hyphen or junk character

Many a times we face a problem wherein mistakenly some files get created in a directory which are hard to rename or remove especially when working with putty terminal, by mistake if you paste come content on command prompt then it will create junk files with hyphen, tilde or any junk character in beginning.

For example “-abc”, “~abc” etc.

Solution:

In this case “rm -abc” or “rm ~abc” etc will not work. Simple solution is to use “rm ./-abc” or “rm./~abc” etc

🙂

Apr 27th, 2010 | Posted by Tushar Thakker | In Linux/Unix/Solaris, Shell scripting, Unix administration
No comments yet.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>