Due to encoding reasons, when uploading or creating Chinese files or directories on the Linux server, garbled characters will be generated. If you want to delete it, you will find that it cannot be deleted with the rm command. In this case, use the find command to delete the garbled files or directories.
1. First enter the directory where the garbled file or directory is located, and use thels -i
command to find the inode of the file or directory (the numeric string in front of the file or directory is the inode)
(Free video tutorial sharing:linux video tutorial)
2. Next, use the find command to query and delete this file or directory
find -inum 2623190 -delete
#Note: This method only works for deleting files or empty folders.
How to delete non-empty folders?
First check the inode first, and then use the following command:
find -inum 2236429 -exec rm -rf {} \;
It will prompt that the file or folder cannot be found, but it has actually been deleted.
Recommended related articles and tutorials:linux tutorial
The above is the detailed content of How to delete garbled files and directories under Linux. For more information, please follow other related articles on the PHP Chinese website!