在Linux中使用反斜杠删除文件 [英] Delete files with backslash in linux

查看:64
本文介绍了在Linux中使用反斜杠删除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不小心创建了一个名称为反斜杠 \ 的文件:

I accidentally created a file which name is a backslash \:

>ls -l
total 0
-rw-rw---- 1 user group  0 Jul  3 21:34 \

如何删除它?

推荐答案

要在参数中将反斜杠传递给命令,您需要对其进行引用"或转义",您可以通过将其包装起来用单引号引起来:

In order to pass a backslash in an argument to a command, you need to "quote" or "escape" it, which you can do either by wrapping it with single-quotes:

rm '\'

或者在它前面加上另一个反斜杠:

or by prefixing it with another backslash:

rm \\

(如果您有一个名为 * 的文件,则需要进行同样的操作.要删除该文件,您可以编写 rm'*' rm \ * rm"*" .大多数其他特殊字符也是如此.)

(The same sort of thing is needed if you, say, have a file named *. To delete it, you would write rm '*' or rm \* or rm "*". And similarly for most other special characters.)

这篇关于在Linux中使用反斜杠删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆