find
eharetea

Using the find command for various tasks in bash.

One of the most useful commands for bash.

Date Created:Friday December 29th, 2006 03:41 AM
Date Modified:Wednesday July 30th, 2008 04:45 PM


LIST FILES AND THEIR SIZE
find ./* -name "*hip*" -exec ls -alh {} \; | awk '{print "    "$5"    "$9}';



EXECUTE
find ./ -name "*.hip" -exec makehelp {} \;



COUNT
find ./* -name "*hip*" -exec ls -alh {} \; | awk '{print "    "$5"    "$9}'|wc



LIST ALL FILES PATHS
find .
find . | xargs


LSIT ALL JPGs
find . -name "*.jpg"


MIXING IT UP
find . -name "*.php"|xargs|awk '{print $3 $9}'


sort -r ifd.ifd

reverse

sort -u ifd.ifd

deletes duplicate lines

sort -n numbers.txt

sorts numerically


# uniq finds duplicates of files
# deletes duplicate lines
sort names | uniq -d     


QUICK...find all directories and list contents

find ./ -type d -ls