Re: delete ~ directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alexander Dalloz wrote:
Am Mo, den 19.04.2004 schrieb Vano Beridze um 09:17:


Hello

I've accidentally (from a java program) created a directory named ~ in
my home directory.
Because ~ is a synonim for a home directory how can I delete this directory safely?
I mean I don't want to delete my whole home directory just that wierd

one.

Thank you
Vano


Besides the other suggestions, as a general annotation too, on bash you
can use

command -- special_sign_name

The leading "--" tells the shell that the following is no options set.
So in your case it would be while you are in the directory where the
miscreated directory is placed

rm -rf -- ~

You can use this too if you accidentally created i.e. a file named "-f"

rm -f    will not work, but
rm -- -f will do.

Alexander

No. "rm -rf -- ~" absolutely WILL expand the ~ and remove your home directory! The expansion of "~" is done by bash, not the rm command. The -- only tells rm not to treat what follows as an option; it does not tell bash not to expand "~". I would hope that you would test before posting such inaccurate and dangerous advice.




[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux