find (find files)

team bbl


Searches specified directories for files or groups of files.

 Format:    find directories conditions Examples:  find /home/janet -name "file*.txt" -print            find . -type d -print 

The first example searches the directory /home/janet, and all its subdirectories, for any files that begin with file and end with .txt. The filenames are displayed. The second example searches the current directory, and its subdirectories, for directories and displays their names.

Rather than options, find uses conditions that are listed after the argument (the path to search). Some conditions are:

Condition

What It Does

Example

-amin +n|-n|n

Find files with last access date more than, less than, or n minutes ago

find . -amin +30

-anewer filen

Find files accessed more recently than filen

find . -anewer report6

-atime +n|-n|n

Find files with last access date more than, less than, or n days ago

find . -atime -5

-cmin +n|-n|n

Find files with last changed date more than, less than, or n minutes ago

find . -ctime +5

-cnewer filen

Find files changed more recently than filen

find . -cnewer report8

-ctime +n|-n|n

Find files with last changed date more than, less than, or n days ago

find . -ctime +5

-group group

Find files owned by this group

find . -group janet

-iname pattern

Find files that match pattern. Ignore case.

find . -iname FileA

-maxdepth n

Search only n levels of subdirectories

find . -maxdepth 2

-mindepth n

Search only deeper than n levels

find . -mindepth 2

-mmin +n|-n|n

Find files with last modified date more than, less than, or n minutes ago

find . -mtime 5

-mtime +n|-n|n

Find files with last modified date more than, less than, or n days ago

find . -mtime 5

-name pattern

Find files that match pattern. use quotes when special characters are used.

find . -name lostfile

-newer filen

Find files modified more recently than filen

find . -newer report8

-nogroup

Find files with nonexistent group name

find . -nogroup

-nouser

Find files with nonexistent username

find . -nouser

-perm mode

Find files with matching permissions

find . -perm 777

-print

Display names of found files

find . -name file1 -print

-size n or nc

Find files n blocks or nc characters long

find . -size 500c

-type c

Find files of specified type: b=block special; c=character special;

d=directory; p=named pipe; l=symbolic link; s=socket; f=plain file

find . -type f

-user user

Find files owned by user

find . -user janet


    team bbl



    Spring Into Linux
    Spring Into Linux
    ISBN: 0131853546
    EAN: 2147483647
    Year: 2005
    Pages: 362
    Authors: Janet Valade

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net