linux locate 快速尋找命令介紹

來源:互聯網
上載者:User

 

時間過得好快,一轉眼一年又快到過年了,很久沒有和大家分享了,工作實在太忙了。

 

使用linux的人都會知道find尋找命令。

 

下面有關於find的使用說明 :linux 尋找命令大全。

 

下面給大家介紹一個快速尋找工具locate,支援正則。

 

一般linux系統都會預設安裝。沒有預設安裝也不要著急。

 

ubuntu:sudo apt-get install locate;

 

centos:yum -y install mlocate;

 

工作原理:通過定時任務定時組建檔案名相關的資料檔案(一般會存放在【/var/lib/mlocate/mlocate.db】),當然定時任務不會很即時,這個會導致剛剛安裝的軟體找不到,這時候大家需要使用(updatedb)來更新locate資料檔案。

 

 

使用方法:locate xx(要尋找的檔案名稱) -l num(要顯示的行數)。當然這個檔案名稱在系統中出現太多,就需要用到-l這個參數。不然等著刷屏吧。

 

正則使用參數:-r, –regexp REGEXP

 

Search for a basic regexp REGEXP.  No PATTERNs  are  allowed  ifthis  option  is used, but this option can be specified multiple

times.

更多使用方法:man locate;

 

http://linux.about.com/od/commands/l/blcmdl1_locate.htm

 

出處: 馬丁部落格

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.