通过 Inode 删除文件
1、查看文件inode
ls -i
eg:aidcsa1@CANGZDLMSS03:/users/aidcsa1> ls -il
total 44
3278052 -rw-r--r-- 1 aidcsa1 hpsecg00 68 2017-03-14 15:34 a
3278079 -rw-r--r-- 1 aidcsa1 hpsecg00 894 2017-04-10 10:52 a.pyc
3276860 drwxr-xr-x 2 aidcsa1 hpsecg00 4096 2014-03-18 16:57 bin
3277552 -rw-r--r-- 1 root root 8128 2017-04-07 00:00 CANGZDLMSS03-dormant.txt
3301414 drwxr-xr-x 3 aidcsa1 hpsecg00 4096 2017-04-12 17:13 checkID
3277732 -rwxr-xr-x 1 aidcsa1 hpsecg00 475 2010-06-15 20:38 dormant-cmd
3276862 -rw-r--r-- 1 root root 879 2014-03-18 17:01 id.txt
3276863 -rw-r--r-- 1 root root 7401 2014-03-18 17:15 login log.txt
3301393 drwxr-xr-x 3 root root 4096 2016-12-08 09:58 test
2、删除对应文件
法一:rm `find . -inum 3278079`;
eg: 删除inode为3278079 的a.pyc文件
aidcsa1@CANGZDLMSS03:/users/aidcsa1> rm `find . -inum 3278079`aidcsa1@CANGZDLMSS03:/users/aidcsa1> ls -li
total 40
3278052 -rw-r--r-- 1 aidcsa1 hpsecg00 68 2017-03-14 15:34 a
3276860 drwxr-xr-x 2 aidcsa1 hpsecg00 4096 2014-03-18 16:57 bin
3277552 -rw-r--r-- 1 root root 8128 2017-04-07 00:00 CANGZDLMSS03-dormant.txt
3301414 drwxr-xr-x 3 aidcsa1 hpsecg00 4096 2017-04-12 17:13 checkID
3277732 -rwxr-xr-x 1 aidcsa1 hpsecg00 475 2010-06-15 20:38 dormant-cmd
3276862 -rw-r--r-- 1 root root 879 2014-03-18 17:01 id.txt
3276863 -rw-r--r-- 1 root root 7401 2014-03-18 17:15 login log.txt
3301393 drwxr-xr-x 3 root root 4096 2016-12-08 09:58 test
法二:find . -inum 3278052 -exec rm -i {} ;
eg:删除inode为3278052 的a文件
aidcsa1@CANGZDLMSS03:/users/aidcsa1> find . -inum 3278052 -exec rm -i {} ;rm: remove regular file `./a'? y
aidcsa1@CANGZDLMSS03:/users/aidcsa1> ls -il
total 36
3276860 drwxr-xr-x 2 aidcsa1 hpsecg00 4096 2014-03-18 16:57 bin
3277552 -rw-r--r-- 1 root root 8128 2017-04-07 00:00 CANGZDLMSS03-dormant.txt
3301414 drwxr-xr-x 3 aidcsa1 hpsecg00 4096 2017-04-12 17:13 checkID
3277732 -rwxr-xr-x 1 aidcsa1 hpsecg00 475 2010-06-15 20:38 dormant-cmd
3276862 -rw-r--r-- 1 root root 879 2014-03-18 17:01 id.txt
3276863 -rw-r--r-- 1 root root 7401 2014-03-18 17:15 login log.txt
3301393 drwxr-xr-x 3 root root 4096 2016-12-08 09:58 test