Find Comand in AIX

find / -xdev -type f -name "cor*" -size +10000c -exec ls -l {} \;

    /                        where to find
    -xdev                    looks only in the given fs
    -type f                  what type to look for (f: file, d: direcory)
    -name "cor*"             name to look for
    -size +10000c            search for the given size (+10000c : greater than 10000 character (larger then 10kbyte))
    -size +2                 search for greater than 1kbyte (bloxk size is 512 byte, that's why +2 is given)
    -exec ls -l {} \;        what command to execute
                             ({}: it represents each findings and \; is needed at the end of line)
                             e.g. find /home -xdev -name "*.old" -exec rm {} \;
    -mtime -1                file modifocation date is less then 1 day (+1 means older than 1 day)

find . -name '*.ksh' -ok rm {} \;                     this will ask if the command (rm) should be  executed or not (much safer if find is not perfect)

find /etc/rc.d -ls           it lists the files and dirs in the given dir

find /tmp/bb -exec awk '/func/ {print FILENAME}' {} \;   it will check in /tmp/bb if any files contains the word "func" and list those

No comments:

Post a Comment