How to delete a directory called ~?

Posted on

How to delete a directory called ~? – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about linux, , , , .

A defect program have created a directory called ~.

If I do rm ~ and then TAB it translates to ~/ which is the users home directory.

How do delete such a directory?

Update

See my answer that solved the problem. It is based on the posted answers.

Solution :

rmdir ./~

So, basically, you’re specifying the path in such a way that there won’t be shell expansion on the “~”.

Use rmdir '~' which should do the trick.

As a general answer for any file.

ls -i

take that number and bung it in find -maxdepth 1 -inum [number] -exec rm -r {} ;

I have confirmed the following works. You can use tab completion on this as well.

rm ./~

Leave a Reply

Your email address will not be published. Required fields are marked *