删除名为 ~ 的文件
Removing a file called ~
我试图将文件移动到我的主目录时不小心将它命名为 ~
。现在在我的 /
中有一个名为 ~
的文件,我不知道如何删除它。
如何删除不小心重命名的文件 ~
?
将文件名放在引号中:
rm '~'
您可以按照 bash
手册:
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. ...
您可以只使用反斜杠将其删除。
rm \~
我试图将文件移动到我的主目录时不小心将它命名为 ~
。现在在我的 /
中有一个名为 ~
的文件,我不知道如何删除它。
如何删除不小心重命名的文件 ~
?
将文件名放在引号中:
rm '~'
您可以按照 bash
手册:
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. ...
您可以只使用反斜杠将其删除。
rm \~