一:演示环境模拟创建 2 个测试文件
linux
环境下,经常见到包含中文命令的文件或文件夹乱码,SFTP连接发现文件正常,命令行不方便操作文件可以根据
Linux
的inode
来修改或删除linux
下乱码的文件
[root@localhost ~]# touch test{1..2}??.txt[root@localhost ~]# ls -l总用量 0-rw-r--r--. 1 root root 0 2月 22 16:50 test1??.txt-rw-r--r--. 1 root root 0 2月 22 16:50 test2??.txt
二:查询文件的inode
[root@localhost ~]# ls -li 总用量 08409167 -rw-r--r--. 1 root root 0 2月 22 16:50 test1??.txt8409191 -rw-r--r--. 1 root root 0 2月 22 16:50 test2??.txt
三:测试修改文件,修改inode
为8409167
的test1乱码文件为test1_fix.txt
[root@localhost ~]# find . -inum 8409167 -exec mv {} test1_fix.txt \;
四:测试删除文件,删除inode
为8409191
的test2乱码文件
[root@localhost ~]# find . -inum 8409191 -exec rm {} \;
五:检查结果(修改一个,删除一个)
[root@localhost ~]# ls -l总用量 0-rw-r--r--. 1 root root 0 2月 22 16:50 test1_fix.txt