find使用方法
1. -name 名字 -size 文件大小 - 小於 + 大於 體積大小 -user owner 2. -ctime 天數,change,表示文件屬性被修改過,所有者,所屬,權限 -atime access 訪問 -mtime 修改 表示文件內容修改過 - 小於 + 大於 -cmin 分種,同上 -amin 分種,同上 -mmin 分種,同上
3. 連接符 -a and -o or ex:find /etc/ -name init* -a -type f
4. -type f 文件 l 軟鏈接文件 d 目錄
ex:find /etc/ -name inittab -o -size +1024k
5: 連接符2: -exec 命令 {} \; {}:find查詢結果 \轉義符,符號命令使用本身的含義 -ok 命令 {} \; ok 提示詢問 ex:find /etc -name inittab -exec ls -l {} \; ex:find /test -name testfile3 -exec rm {} \; ex:find /home -user samlee -exec rm -rf {} \; ex:find /etc -name inittab -ok rm {} \; ex:find /etc -name init* -a -type f -exec ls -l {} \;
6. -inum i節點 通過i節點刪除文件 ex:find . -inum 16 -exec rm {} \;
7 -perm 4775 剛好等於 -perm -4775 -指必須要全部包括mode的權限 +4775 +包括任一mode的權限 ex: find /-perm +7000