问题
I accidentally named a file ~
when I was trying to move it to my home directory. And now in my /
there is a file called ~
and I have no idea how I would remove it.
How would I remove a file that I accidentally renamed ~
?
回答1:
Put the filename in quotes:
rm '~'
You can follow the bash
manual:
https://www.gnu.org/software/bash/manual/html_node/Tilde-Expansion.html
If a word begins with an unquoted tilde character (‘~’), all of the characters up to the first unquoted slash (or all characters, if there is no unquoted slash) are considered a tilde-prefix. ...
回答2:
You could just use a backslash to remove it.
rm \~
来源:https://stackoverflow.com/questions/34619406/removing-a-file-called