2019年7月4日 星期四

找檔案指令

find: 要指定搜尋的路徑,否則就只有搜尋目前所在的資料夾.ie:  find /etc hosts
在目前目錄下,尋找檔名含 "foo" 字母的檔案
$ find ./ -name "*foo*"
找尋 近100天內 被修改的檔案
$ find / -mtime -100 
找尋 100天之前被修改的檔案
$  find / -mtime +100 
locate: 搜尋 updatedb指令所建的資料庫.快! 但未執行 updatedb之前的新檔,會找不到.
whereis: 只會搜尋/usr、/bin 或 /etc 等幾個特定的路徑(找執行檔、原始檔及man說明),不適於找家目錄的檔.
which: 只用來搜尋 Ubuntu/Linux 的指令程式.

沒有留言: