關於 PHP, Linux, Open Source 及個人生活記載的網誌。
RSS icon
  • Linux 的搜尋技巧

    Posted on December 6th, 2007 Sam Tang No comments

    在檔案內搜尋指定文字,search_key 是搜尋字串,/path/to/filename 是檔案名稱:
    grep search_key /path/to/filename

    功能同上,但不分大小寫:
    grep -i search_key /path/to/filename

    搜尋檔案:在指定目錄中搜尋檔案,以下是在 /var/www/ 目錄下搜尋 upload.php 的檔案:
    find /var/www/ -name upload.php

    功能同上,但目標不是檔案,而是目錄:
    find /var/www/ -name uploads -type d

    還有更多有用的功能,以上只列出較常用的用法。


    Leave a reply

    *
    To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
    Click to hear an audio file of the anti-spam word