2010年8月6日 星期五

檔案搜尋

which (尋找命令的儲存位址)
# which bash
/bin/bash
# which ping
/bin/ping
student@U104-Desktop:~$ which sudo
/usr/bin/sudo
student@U104-Desktop:~$ which nano
/usr/bin/nano

locate (利用索引資料庫, 搜尋檔案)
touch abc.txt     (建立abc.txt檔案)
locate abc.txt    (找不到,因為資料庫中沒有abc.txt)
updatedb          (更新資料庫
更新完就可以找到
locate abc.txt
/home/student/abc.txt

find (很操硬碟,速度慢)
find  /usr  -name “*csh*” (搜尋/usr目錄下所有子目錄
find  /  -maxdepth  1     (從根目錄開始找 只找一層
find   /  -size  +500k    (從根目錄開始找 找大於500k以上的檔案
find  /root  ctime  1     (/root目錄中 一小時內有修改的檔案

沒有留言:

張貼留言