Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use inode to delete files under Linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to delete files using inode under Linux", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to delete files using inode under Linux" this article.

Inode contains a lot of file meta-information, but does not contain file names, such as: number of bytes, owner UserID, dependency group GroupID, read and write execution permissions, timestamps, and so on. The file name is stored in the directory, but the Linux system does not use the file name, but uses the inode number to identify the file. For the system, the file name is just an alias for the inode number to be easily identified.

How to find out the inode of a file?

Use stat or ls-il. The ls command with the-I argument refers to the inode that displays the file.

How do I delete this file after I find inode?

Find. -inum [inode number]-exec rm-I {} /

1) Let's do a complete experiment and create a file with special characters:

$cd / tmp$ touch "/ + Xy / + / 8" $ls

2) try to delete with the rm command

$rm / + Xy / + / 8

3) find out the inode number of this file

$ls-il342137-rw-r-r- 1 tw tw 0 2008-11-2008: 57 / + Xy / + / 8

4) 342137 is the inode number we are looking for. Now delete it with the find command

$find. -inum 342137-exec rm-I {} /

For example, you have the file "2008-11-20" in your system, and you can't delete it with rm. Linux does not allow you to create this file, but you can do it under Windows. So this is the use of find with inode.

You can try to delete the file with quotation marks on the file name.

For example, the "- help" file can be deleted with rm "- help".

You can also delete files with unlink.

The unlink command calls the unlink function, which deletes a specific file.

Use mtools to delete illegal files created under Windows.

This method is most useful when the find command fails with inode. Folders created specifically for dealing with autorun.inf viruses.

The above is all the contents of the article "how to use inode to delete files under Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report