find
find specific file
directory :
$ find -type d
$ find . -type d
$ find /tmp -type d
regular file :
$ find -type f
specific filename :
$ find . -name "*.rst"
$ find . -type f -name "*.rst"
execute command for specific file :
$ find . -type f -exec ls -al {} \;
$ find . -type f -exec chmod 644 {} \;
mv :
# files that create in last 30 minutes
# move to tmpdir/
$ find . -cmin -30 -type f -exec mv -t tmpdir/ {} +
case insensitive:
find . -iname ...
尋找後依照檔案大小排序:
find . -type f -exec ls -s {} \; | sort -nr | head
尋找後搬進特定資料夾:
find . -newermt 2016-08-24 -maxdepth 1 -exec mv {} ../newdir/ \;