The Find command application under Linux

Source: Internet
Author: User

Linux under the Find command, Gray is always important! 650) this.width=650; "src=" Http://img.baidu.com/hi/babycat/C_0016.gif "alt=" C_0016.gif "/>

The find command under Linux searches the directory structure for files and performs the specified actions.

1. Command format

Find Pathname-options [-print-exec-ok ...] .

2. Command function

Locate the file in the file tree and make the appropriate processing (possibly accessing the disk).

3. Command parameters

The target path that the Pathname:find command looks for.

. Represents the current directory;/ represents the system root directory.

650) this.width=650; "title=" 11.png "src=" http://s4.51cto.com/wyfs02/M00/81/F9/wKiom1dGeo-AOGO1AAA5DoCsXlQ625.png "alt=" Wkiom1dgeo-aogo1aaa5docsxlq625.png "/>

-print: Thefind command outputs the matching file to standard output.

650) this.width=650; "title=" 00.png "src=" http://s1.51cto.com/wyfs02/M02/81/F8/wKiom1dGeZagJ2F0AAA5NCNI8L8273.png "alt=" Wkiom1dgezagj2f0aaa5ncni8l8273.png "/>

-exec: Executes the Shell command given by the parameter to the matching file.

-OK: It works the same as -exec , except that the execution mode is more secure, and the user is determined whether or not to execute it before each command.

4. Command options

-name finds files by file name.

650) this.width=650; "title=" 5.png "src=" Http://s5.51cto.com/wyfs02/M00/81/F7/wKioL1dGeQDz5YmaAAANv5ad_2c399.png " alt= "Wkiol1dgeqdz5ymaaaanv5ad_2c399.png"/>

-perm Search for files according to file permissions.

-prune the Find command is not found under the currently specified directory, and if you use the -depth option at the same time, -prune will be ignored by the find directive.

650) this.width=650; "title=" 0.png "src=" Http://s1.51cto.com/wyfs02/M01/81/F7/wKioL1dGejbTYKEUAAAxaWs2RV8450.png " alt= "Wkiol1dgejbtykeuaaaxaws2rv8450.png"/>

-user Search for files according to the file's main nature.

-group finds files according to the group the file belongs to.

-nogroup Lookup does not have a valid owning group file, that is, the group that the file belongs to does not exist in /etc/groups .

650) this.width=650; "style=" Float:none; "title=" 6.png "src=" http://s5.51cto.com/wyfs02/M02/81/F7/ Wkiol1dgez6rbojhaaavnbdgxly310.png "alt=" Wkiol1dgez6rbojhaaavnbdgxly310.png "/>

-nouser Lookup does not have a valid owning primary file, that is, the file belongs to a group that does not exist in /etc/passwd .

650) this.width=650; "style=" Float:none; "title=" 7.png "src=" http://s5.51cto.com/wyfs02/M01/81/F8/ Wkiom1dgekmr2mqiaaavikq-ane501.png "alt=" Wkiom1dgekmr2mqiaaavikq-ane501.png "/>

-mtime-n +n to find files according to the time the file was changed.

- n indicates that the file change time is less than n days;

650) this.width=650; "title=" 1.jpg "src=" Http://s2.51cto.com/wyfs02/M02/81/F7/wKiom1dGcUPBpei8AAG91J2CA04165.jpg " alt= "Wkiom1dgcupbpei8aag91j2ca04165.jpg"/>

+n indicates that the file change time is now n days ago.

650) this.width=650; "title=" 2.jpg "src=" Http://s4.51cto.com/wyfs02/M00/81/F6/wKioL1dGcvSjKNGqAAHKC3iYfko589.jpg " alt= "Wkiol1dgcvsjkngqaahkc3iyfko589.jpg"/>

The find command also has -atime and -ctime, both of which are identical to -mtime .

-newer file1! File2 find time than file file1 new but older file file2 than file.

650) this.width=650; "title=" 33.png "src=" http://s1.51cto.com/wyfs02/M02/81/F9/wKiom1dGe-eTjvGUAAAmXpi2Ir0220.png "alt=" Wkiom1dge-etjvguaaamxpi2ir0220.png "/>

-type find a file of a certain type.

B-Block device files

650) this.width=650; "title=" 3.png "src=" Http://s5.51cto.com/wyfs02/M01/81/F8/wKiom1dGc06C4EEmAAAvuqh_3H8634.png " alt= "Wkiom1dgc06c4eemaaavuqh_3h8634.png"/>

C-Character device files

650) this.width=650; "style=" Float:none; "title=" 4.png "src=" http://s5.51cto.com/wyfs02/M00/81/F6/ Wkiol1dgdosjg0teaaawujor_ho122.png "alt=" Wkiol1dgdosjg0teaaawujor_ho122.png "/>

D-Catalog

650) this.width=650; "style=" Float:none; "title=" 5.png "src=" http://s5.51cto.com/wyfs02/M02/81/F8/wKiom1dGc_ Chun8haaa9orfkybm379.png "alt=" Wkiom1dgc_chun8haaa9orfkybm379.png "/>

P-Piping File

650) this.width=650; "style=" Float:none; "title=" 8.png "src=" http://s4.51cto.com/wyfs02/M00/81/F7/ Wkiol1dgdx3gcwp6aaavxfiev4a474.png "alt=" Wkiol1dgdx3gcwp6aaavxfiev4a474.png "/>

L-Symbolic Link file

650) this.width=650; "style=" Float:none; "title=" 6.png "src=" http://s3.51cto.com/wyfs02/M02/81/F6/ Wkiol1dgdoxqr17laaat12kb8ac626.png "alt=" Wkiol1dgdoxqr17laaat12kb8ac626.png "/>

F- normal file

650) this.width=650; "style=" Float:none; "title=" 7.png "src=" http://s4.51cto.com/wyfs02/M02/81/F7/ Wkiol1dgdx2rct6aaabyeajjnsg956.png "alt=" Wkiol1dgdx2rct6aaabyeajjnsg956.png "/>

-size N: [C] finds files with a file length of N, with C indicating the length of the file is calculated in bytes.

-depth find a file, find it in the current directory, and then look under its subdirectories.

650) this.width=650; "style=" Float:none; "title=" 1.png "src=" Http://s1.51cto.com/wyfs02/M02/81/F7/wKioL1dGd_ 7d7yuxaaa6ckvfwgi982.png "alt=" Wkiol1dgd_7d7yuxaaa6ckvfwgi982.png "/>

-fstype Find files located in a type of file system. The file system type is typically in the provisioning file

/etc/fstab , this configuration file contains information about the file system in the system.

-mount does not cross file system mount points when locating files.

650) this.width=650; "style=" Float:none; "title=" 2.png "src=" http://s2.51cto.com/wyfs02/M00/81/F8/ Wkiom1dgdwvirv6iaaa35mffrra796.png "alt=" Wkiom1dgdwvirv6iaaa35mffrra796.png "/>

-cpio Use the cpio command on the matching files to back up these files to the tape device.

-follow if the find command encounters a symbolic link file, it tracks to the file that the link points to.

650) this.width=650; "style=" Float:none; "title=" 3.png "src=" http://s2.51cto.com/wyfs02/M00/81/F7/ Wkiol1dgeagwimecaaa5s7lkrn4471.png "alt=" Wkiol1dgeagwimecaaa5s7lkrn4471.png "/>

The Find command application under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.