Home  >  Article  >  Operation and Maintenance  >  How to delete inode files under Linux

How to delete inode files under Linux

WBOY
WBOYforward
2023-05-17 21:23:452358browse

1. Find the inode of the file

Use stat or ls -i. The ls command with the -i parameter means to display the inode of the file.

2. Delete

find . -inum [inode number] -exec rm -i {} \.

You can test it below and create a file with special characters:

$ cd /tmp

$ touch “\Xy \ \8″

$ ls

Try to use the rm command to delete

$ rm \ Xy \ \8

Find out the inode number of this file

$ ls -il

342137 -rw-r–r– 1 tw tw 0 2008-11-20 08:57 \ Xy \ \8

342137 is the inode number you are looking for. Use the find command to delete it below

$ find . -inum 342137 -exec rm -i {} \

For example, if you have the file "2008/11/20" in your system, use rm cannot be deleted. Linux does not allow you to create this file, but it is possible under Windows, so this is where find is used in conjunction with inode.

The above is the detailed content of How to delete inode files under Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete