天天看點

Linux下結合inode删除特殊檔案

1、ls -li (檢視檔案的inode号)

<code>root@DY1100S01:[</code><code>/tmp/2015-10-14</code><code>]</code><code>ls</code> <code>-li</code>

<code>總用量 12</code>

<code>1444367 -rw-r--r-- 1 root wanlong 3983 10月 14 17:00 mima</code>

<code>1444385 -rw-r--r-- 1 root wanlong 3983 10月 14 17:00 </code><code>passwd</code>

<code>1444312 -rw-r--r-- 1 root wanlong 3983 10月 14 17:00 secure</code>

2、使用find結合inode來删除檔案

比如我需要删除mima的檔案

<code>root@DY1100S01:[</code><code>/tmp/2015-10-14</code><code>]</code><code>find</code> <code>. -inum 1444367 -</code><code>exec</code> <code>rm</code> <code>-rf {} \;</code>

<code>總用量 8</code>

說明:find . -inum 1444367 -exec rm -rf {} \;等同于find . -inum 1444367|xargs rm -rf

本文轉自 冰凍vs西瓜 51CTO部落格,原文連結:http://blog.51cto.com/molewan/1703103,如需轉載請自行聯系原作者

繼續閱讀