Home > Article > Operation and Maintenance > How to delete garbled files under Linux
Deleting files under Linux is a very troublesome thing when encountering special characters.
The deletion method is: rm -- file name
For example, the file name is: -pythontab.tgz
If you use ordinary methods to delete:
rm -pythontab.tgz
The result is error:
rm: invalid option -- pythontab
Try `rm --help' for more information.
can be used:
rm -- -pythontab.tgz
will be deleted successfully.
For file names containing other special characters, such as a8093152e673feb7aba1828c43532094!*, etc., you can use
"" to escape Symbol or "" double quotation marks to enclose the control
such as ">" or "*"
[root@test]# rm > [root@test]# rm “*”
There is a file in the system whose file name is all garbled, and there is no way to delete it (the system cannot print garbled symbols). At this time, we can use the inode number to delete it.
[root@test]# ll -i total 14694452 17956913 -rw-r--r-- 1 test test 4096 Nov 24 16:24 1?.txt [root@test]# find . -inum 17956913 -exec rm {} \;
After testing, the above method is definitely available
The above is the detailed content of How to delete garbled files under Linux. For more information, please follow other related articles on the PHP Chinese website!