find

Finding files with find

Finding files with the find command is actually more difficult than it should be.
This finds and lists the largest files (more than 200 MB) on the whole file system:
find / -type f -size +200000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
The same, but simpler syntax:
find / -size +200M -ls
This finds the most recently changed files under the current directory:
find . -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort

Piping the output of find into a new command (find, xargs)

E.g. to change the permissions of all directories:

find . -type d -print | xargs /bin/chmod ug+rx

To be able to handle directory names with special characters

find . -type d -print0 | xargs -0 /bin/chmod ug+rx

In order to find all tif files in the current directory or below and to compress them (using the ImageMagick "mogrify" command and LZW compression):

find . -name '*.tif' -print | xargs mogrify -compress LZW

Find and replace with perl

To replace the string jeltsch.blogspot.com by the string mnm.no-ip.com/blog you can use perl:perl -pi.bak -e 's|jeltsch.blogspot.com|mnm.no-ip.com\/blog|g' *.html If you want to do a recursive replacement on a directory tree you can try:perl -pi.bak -e 's|jeltsch.blogspot.com|mnm.no-ip.com\/blog|g' `find jeltsch.org -name '*.html'`