Reputation: 6314
Under my home directory I see a directory named ~
. I guess I must have accidentally copied my home directory somehow.
Anyway, it's eaten up all my space and I'd like to remove it but obviously just running rm -r ~
will delete the entire contents of my home directory.
Any idea how to delete that ~
directory without any damage?
Upvotes: 0
Views: 129
Reputation: 17501
You can try to make an ls | grep -v <other files>
statement, which ignores all the other files, so that it only lists the file with that weird name.
Then you do:
rm $(ls | grep -v <other files>)
Obviously, you need to be careful first to test this thoroughly.
Upvotes: 1
Reputation: 11
I would use rm -rf \~
The \
escape key should stop you from deleting you're home directory.
Upvotes: 1
Reputation: 361730
Escape it so the shell doesn't expand the tilde. Any of these will do:
rm -r '~'
rm -r \~
rm -r ~/'~'
rm -r ~/\~
Upvotes: 1