Linux命令整理 檔案搜尋

2021-10-24 06:28:52 字數 574 閱讀 4598

find / -name file1 從 '/' 開始進入根檔案系統搜尋檔案和目錄 

find / -user user1 搜尋屬於使用者 'user1' 的檔案和目錄 

find /home/user1 -name \*.bin 在目錄 '/ home/user1' 中搜尋帶有'.bin' 結尾的檔案 

find /usr/bin -type f -atime +100 搜尋在過去100天內未被使用過的執行檔案 

find /usr/bin -type f -mtime -10 搜尋在10天內被建立或者修改過的檔案 

find / -name \*.rpm -exec chmod 755 '{}' \; 搜尋以 '.rpm' 結尾的檔案並定義其許可權 

find / -xdev -name \*.rpm 搜尋以 '.rpm' 結尾的檔案,忽略光碟機、捷盤等可移動裝置 

locate \*.ps 尋找以 '.ps' 結尾的檔案 - 先執行 'updatedb' 命令 

whereis halt 顯示乙個二進位制檔案、原始碼或man的位置 

which halt 顯示乙個二進位制檔案或可執行檔案的完整路徑 

Linux 搜尋檔案命令

find 命令 name或者 iname name和 iname的區別乙個區分大小寫,乙個不區分大小寫 ex 在 etc 目錄下搜尋名字為init的檔案或目錄 find etc name init 精準搜尋,名字必須為 init 才能搜尋的到 find etc iname init 精準搜尋,名字必...

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這個資...