Linux下特殊符号文件名的删除方法

2022年06月13日

原创内容,转载请注明出处:https://www.myzhenai.com.cn/post/4161.html

今天在对服务器进行操作的时候,我发现目录下有一个奇怪的文件名,是一个问号 ? 这个文件并不是我创建的,不知道是怎么创建出来的,我知道不能使用 rm -rf ? 来进行删除,因为这样有可能会对系统造成破坏。

我切换到目录下,使用 ls -bl 命令,看到文件名是 ”\r”  使用 du -sh * | sort -n 命令来查看,看到的是 空白的  文件名。

后来,在另外一个大佬的指点下,使用文件ID来进行删除,

cd aaa
#aaa是文件所在目录
ls -i
#列出当前目录所有文件和子目录的文件ID
find . -inum xxxxx -delete
#.半角下的点,即是当前目录,xxxxx是根据 ls -i 获取到的需要删除的文件ID(数字)

 


sicnature ---------------------------------------------------------------------
Your current IP address is: 44.204.65.189
Your IP address location: 美国弗吉尼亚阿什本
Your IP address country and region: 美国 美国
Your current browser is:
Your current system is:
Original content, please indicate the source:
同福客栈论坛 | 蟒蛇科普海南乡情论坛 | JiaYu Blog
sicnature ---------------------------------------------------------------------
Welcome to reprint. Please indicate the source http://www.myzhenai.com/post/4161.html

没有评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注