#搜尋資料夾 並把-1刪除
for file in `ls -d */`;do mv $file `echo $file|sed 's/-1//g'`;done
#搜尋資料夾 並把-1取代-2
for file in `ls -d */`;do mv $file `echo $file|sed 's/-1/-2/g'`;done
#搜尋.jpg檔名 並把_finished刪除
for file in `ls *.jpg`;do mv $file `echo $file|sed 's/_finished//g'`;done;
#搜尋.jpg檔名 並把_finished刪除
ls *.jpg |awk -F "_finished" '{print "mv "$0" "$1$2""}'|bash
#搜尋重覆檔案並排序 檢查md5 hash值是否一樣
find . -type f -exec md5sum '{}' ';' | sort | uniq --all-repeated=separate -w 24
find . -type f -exec md5sum '{}' ';' | sort | uniq --all-repeated=separate -w 24 | grep web.xml
find . -type f -exec md5sum '{}' ';' | sort | uniq --all-repeated=separate -w 24 | grep authadmin-api-3 | egrep jar
#搜尋檔案大小
find . -type f -printf "%p - %s\n" | sort -nr -k3 | uniq -D -f1
#搜尋檔案並尋找內容關鍵文字
find /var/gb/apps/ -name "*.properties" | xargs grep kafka-servers
find /var/h-gb/apps/ -name "base-conf.properties" | xargs grep H=1
#搜尋檔案並尋找及取代關鍵文字
find /var/gb/apps/ -name "*.properties" | xargs sed -i 's#^kafka-servers=.*$#kafka-servers='"10.28.10.41:9092,10.28.10.42:9092,10.28.10.43:9092"'#'
find /var/h-gb/apps/ -name "base-conf.properties" | xargs sed -i 's#^H=.*$#H='"2"'#'
#搜尋最後10-20分有變過動的檔案
find / -mmin +10 -mmin -20 -type f
#搜尋最後5分鐘有變動過的檔案
find / -mmin -5 -type f
find /etc /var /mnt /media -xdev -mmin -5 -type f
#搜尋排除指定目錄
find / \( -name proc -o -name sys -o -name .mozilla -o -name chromium \) -prune -o -type f -mmin -10 -printf "%Ac\t%p\n"
#搜尋特定的副檔名檔案
find . -name "*.png" -o -name "*.jpg" -o -name "*.gif" -type f

 

By tony

自由軟體愛好者~喜歡不斷的思考各種問題,有新的事物都會想去學習嘗試 做實驗並熱衷研究 沒有所謂頂天的技術 只有謙虛及不斷的學習 精進專業,本站主要以分享系統及網路相關知識、資源而建立。 Github http://stnet253.github.io

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料