find命令高階用法

2022-08-09 13:51:16 字數 662 閱讀 8679

1. 目錄和檔案使用不同的許可權

# 查詢當前目錄,所有檔案型別為d[目錄]的檔案 執行命令 chmod

755find . -type d -exec chmod

755{} \;

# 查詢當前目錄,所有檔案型別為f[檔案]的檔案 執行命令

chmod

644find . -type f -exec chmod

644 {} \;

2. 刪除不顯示字元檔名的檔案

find . -inum [inode] -exec rm {} \;

例子:

[root@localhost ~]#

ls -il

total 420

202645692 -rw-r--r-- 1 root root 4096 jan 10 19:41 ??[root@localhost ~]#

find . -inum 202645692

./??[root@localhost ~]#

find . -inum 202645692 -exec rm {} \;

[root@localhost ~]#

find . -inum 202645692

[root@localhost ~]#

find命令用法

關於查詢 檔案查詢 locate非實時查詢 根據索引查詢 find實時查詢 根據檔案的各種屬性去找到相對應檔案 根據檔案的各種屬性去找到相對應檔案 文字搜尋 grep,egrep,fgrep find的用法 查詢條件 檔名類 使用者和組類 檔案型別 大小和時間 根據許可權查詢 組合條件查詢 處理動作...

find命令用法筆記

1.find type f size 200k a size 210k 找到當前目錄及其子目錄下的所有大於200k且小於210k大小的檔案 size n bckw 查詢指定檔案大小的檔案,n後面的字元表示單位,預設為b,代表512位元組的塊。type x 查詢型別為x的檔案,x為下列字元之一 b 塊...

find命令的用法

linu查詢find命令及刪除7天前的檔案 原創碼上筆記 發布於2017 10 16 16 57 49 閱讀數 14910 收藏 展開在 l o g s目錄中查詢更改時間在7日以前的檔案並刪除它們 find logs type f mtime 7 exec rm f 在 l o g s目錄中查詢更改...