Linux命令 檔案搜尋命令 find

2021-09-09 01:22:16 字數 2013 閱讀 3456

選項:

-name表示按檔名稱查詢

find /etc -name init  搜尋etc目錄下面的檔名為init的所有檔案(精確搜尋)

find /etc -name *init*  搜尋etc目錄下面的檔名包含init的所有檔案(模糊搜尋),init*,init???(*表示任意字元,?表示乙個字元),檔名區分大小寫

touch /etc/inittab 建立inittab檔案

find /etc -name init???搜尋init開頭後面必須跟三個字元的檔名(區分大小寫)

find /etc -iname inti??? 搜尋init開頭後面必須跟三個字元的檔名(忽略大小寫)

find / -size +204800  查詢根目錄下大於100m的檔案

find /home -user wangyunpeng 查詢/home目錄下面所有者是wangyunpeng的所有檔案

find /etc -mmin -30 查詢etc目錄最近30分鐘內檔案內容被修改過的所有檔案

find /etc -name init*查詢etc目錄中名稱以init開頭的所有資訊(檔案、目錄、軟連線)

find /etc -name init* -a -type f 查詢etc目錄中名稱以init開頭的所有檔案資訊

find /etc -name init* -a -type d 查詢etc目錄中名稱以init開頭的所有目錄資訊

find /etc -name init* -a -type l 查詢etc目錄中名稱以init開頭的所有軟連線資訊

find /etc -name inittab -exec ls -l {} \; 查詢etc目錄下名稱為inittab的結果,並顯示搜尋結果的詳細資訊

find /etc -name init* -a -type f -exec ls -l {} \;  查詢etc目錄下init開頭的所有檔案,並顯示出每乙個檔案的詳細資訊

find /etc -name init* -a -type f -exec ls -l {} \;   查詢etc目錄下init開頭的所有檔案,並詢問使用者是否顯示出每乙個檔案的詳細資訊

find /home -user wangyunpeng -ok rm {} \;  查詢home目錄下所有者是wangyunpeng的所有資訊,並詢問是否刪除每乙個查詢出來的資訊

linux檔案搜尋命令和命令搜尋命令

1.locate 速度快 find 搜尋全部檔案 1 locate 檔名 在後台資料庫中按檔名搜尋 2 資料庫所在位置 var lib mlocate 可以切換到該目錄下看看 3 用命令updatedb更新後台資料庫 4 配置檔案在 etc updatedb.config 開啟檔案搜尋位置限制時可以...

linux 檔案搜尋命令

1,locate 檔名 1 如果touch乙個檔案,locate不會搜尋出來,是因為這個不是實時查詢的,他是搜尋的檔案資源庫在 var lib molcate mlocate.db中,需要updatedb更新一下db這個檔案 2 locate不能查詢tmp目錄下的檔案 i 不區分大小寫 2,whic...

Linux檔案搜尋命令

又要開始linux命令了!gogo locate 檔名 在後台資料庫中按檔名搜尋,搜尋速度更快。注意 只能夠按照檔名搜尋 q 在這裡我發現,搜尋第乙個檔案的時候是可以搜尋出來的,但我新建了乙個檔案,再搜尋就搜尋不出來了,這是為什麼呢?a 原來locate命令是從 var lib mlocate這個資...