How to delete inode files under Linux

08-01-2023

Today, the editor will share with you the relevant knowledge points on how to delete inode files under Linux. I hope you have gained something after reading this article. Let's find out together.

1. Find the inode of the file

Use stat or ls -i, the ls command with the -i parameter refers to the inode of the displayed 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 delete with rm command

$ rm \+Xy \+\8

Find out the inode number of this file< /p>

$ 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, your system has 2008/11/20″This file cannot be deleted with rm. Linux does not allow you to create this file, but it can be done under Windows, so the use of find and inode is here.

The above is all the content of this article on how to delete inode files under Linux, thank you for reading! I believe that everyone has gained a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the Yisu cloud industry information channel.

Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us