debugfs 不统计带有空格的文件名

debugfs 不统计带有空格的文件名

我正在使用debugfsstat 来获取带空格的文件名。文件存在,但我收到此消息(如果我更改空格\或在简单引号之间写入文件名,也会收到相同的消息):

$ sudo debugfs -R "stat /home/user/This is a test.txt" /dev/mapper/VolGroup00-lv_root
debugfs 1.44.5 (15-Dec-2018)
stat: Usage: stat <file>

如果我使用这种格式,我会收到此错误:

$ sudo debugfs -R "stat $'/home/user/This\x20is\x20a\x20test.txt'" /dev/mapper/VolGroup00-lv_root 
debugfs 1.44.5 (15-Dec-2018)
$'/home/user/This\x20is\x20a\x20test.txt': File not found by ext2_lookup 

如果我使用这种格式,我会收到此错误:

$ sudo debugfs -R "stat $'/home/user/This\024is\024a\024test.txt'" /dev/mapper/VolGroup00-lv_root 
debugfs 1.44.5 (15-Dec-2018)
$'/home/user/This\024is\024a\024test.txt': File not found by ext2_lookup 

是否可以使用 来统计带有空格的文件名debugfs

答案1

statindebugfs只需要一个参数(因此Usage: stat <file>)。您提供的字符串

/home/user/This is a test.txt

被视为由空格分隔的多个参数。不过,该工具支持使用双引号引用。这将起作用:

sudo debugfs -R 'stat "/home/user/This is a test.txt"' /dev/mapper/VolGroup00-lv_root

相关内容