Unix delete or rename a file starting with hyphen or junk character
April 27th, 2010
No comments
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
Categories: Linux/Unix/Solaris, Shell scripting, Unix administration delete, file, junk character, Linux, putty, rename, solaris, Unix