added new examples for find

This commit is contained in:
Pierre Poulain 2013-08-28 11:15:59 +01:00
parent 437f191bf7
commit 79a091a275

View File

@ -1,4 +1,4 @@
# To find files by extension (ex: .jpg): # To find files by cas insensitive extension (ex: .jpg, .JPG, .jpG):
find . -iname "*.jpg" find . -iname "*.jpg"
# To find directories: # To find directories:
@ -12,3 +12,13 @@ find . -type f -perm 777
# To find files with setuid bit set: # To find files with setuid bit set:
find . -xdev \( -perm -4000 \) -type f -print0 | xargs -0 ls -l find . -xdev \( -perm -4000 \) -type f -print0 | xargs -0 ls -l
# To find files with extension '.txt' and remove them:
find ./path/ -name '*.txt' -exec rm {} \;
# To find files with extension '.txt' and look for a string into them:
find ./path/ -name '*.txt' | xargs grep 'string'
# To find files with size bigger than 5 Mb and sort them by size:
find ./ -size +5M -type f -print0 | xargs -0 ls -Ssh