The inode of a file defines the size of the file, the characteristics of the file for everyone, and so on. Each file and directory has its own unique inode number. But why use inode to delete files instead of using the usual rm -rf command? The reason is that if you accidentally create files and directories with special characters, such as filenames with ? * ^, it will be difficult to delete. Here we will introduce: 1) how to find the inode of files and directories; 2) delete the specific inode file with the find command; 3) other useful methods to delete stubborn files. * How to find the inode of a file?
Use stat or ls -il. The ls command with the -i parameter refers to the inode of the display file.
* How do I delete this file after finding the inode? Find . -inum [inode number] -exec rm -i {} /;
1) Let's complete the experiment and create a file with special characters:
$ cd /tmp $ Touch “/+Xy /+/8″ $ ls
2) Try to delete with rm command
$ rm /+Xy /+/8
3) Find The inode number of this file
$ ls -il 342137 -rw-r–r– 1 tw tw 0 2008-11-20 08:57 /+Xy /+/8
4 ) 342137 is the inode number we are looking for. Use the find command to delete it
$ find . -inum 342137 -exec rm -i {} /;
For example, your system has ”2008/11/20″ With rm it can't be deleted. Linux does not allow you to create this file, but it works on Windows. So the use of find with inode is here.
Here are some other useful tips for removing:
* You can try to delete files by quoting the file name. For example, “–help” files, you can use rm “–help”delete
* You can also delete files with unlink. Unlink. The unlink command calls the unlink function to delete a specific file.
* Use mtools to delete illegal files created under Windows. This method is most useful when the find command matches the inode failure. Specially deal with the folder created by the autorun.inf virus.
You can also use xargs with rm to delete files in different locations in batches: write the full path of the file to be deleted to a text file, such as file.txt as follows: file1 /tmp/file2.txt ~/data .txt
Then run the following command to delete the file listed in file.txt $ xargs rm
First, the environment: vmware workstaion 9.0centos 6.2iou-web Second, installation 1. Installation
For ease of use, we will save the Xshell session. How to transfer the session information saved on
The Linux boot file is stored in the grub.conf configuration file in the /boot/grub/directory. 1.
Multiple startup files Adding multiple startup files by saying that compilation will be wrong. But t
There are several ways to mount rootfs when Linux starts.
Linux Shell Script Common Command Manual
Windows XP system troubleshooting method
Nagios latest version installation under CentOS5.5
Two "BBC" recovery corrupted Linux systems
N kinds of weapons for finding vulnerabilities under Linux
Automotive industry dealing with the Linux operating system
Analysis of the application of Linux system in DVR equipment
WinXP system quickly closes multiple windows before shutting down
How to implement 3D 3D switching page in win7
Windows 7 taskbar vs. Apple MacDock
Win7 system mistakenly delete QQ friends how to do?
Memory failure causes the server to work abnormally
WinXP uses commands to view all ports and designated ports.
Vista power button sleep sleep and shutdown settings
Install Win 7 to a virtual disk with a VHD file (1)
7 method tips for transferring pictures between iPhone and Mac