2018年7月4日水曜日

[Linux] 在 linux 下用 command 搜尋資料夾底下所有檔案內容文字的方法


記性太差,用了那麼多次還是不記得,只好乖乖的把它紀錄下來了。


find <path> -name "<file>" -exec grep -H "<content_string>" {} \; > <output_file>
find * -name "*.*" -exec grep -H "something" {} \; > output.txt


平行化:
find <path> -name "<file>" parallel -j<N> grep -H <content_string> {} > <output_file>
find * -name "*.*" | parallel -j8 grep -H "something" {} > output.txt

試了一下 

結果看起來好像更慢了 

也許是因為是個5400RPM的HDD的關係 

可能換顆SSD會快一點

 
就這樣沒了