Find command for Linux

Source: Internet
Author: User

The common form of the find command is: Find pathname-options [-print-Exec-OK].

Find Command Options:

-Name: searches for files by file name, for example, find/etc-name "Host *"-print | xargs>/tmp/host. Log

-Perm searches for files based on the file permissions, for example, find.-Perm 755-print

-The user searches for files based on the file owner, for example, find ~ -User Dave-print

-Group: searches for files based on the group to which the files belong, for example, find/apps-group Beijing-print.

-Nouser: Search for files without a valid owner, for example, find/-nouser-print

-Nogroup: searches for files without a valid group, for example, find/-nogroup-print

-Size N [c]: searches for files with N blocks in length. If the file contains C, the file length is measured in bytes, for example, find/home/Apache-size 100c-print.

-When searching for files, depth first searches for files in the current directory, and then searches for files in its subdirectories.

-Fstype: searches for files in a certain type of file system. These file system types can usually be found in the configuration file/etc/fstab, this configuration file contains information about the file system in the system.

-Mount does not span the mount point of the file system when searching for files, for example, find.-Name "*. XC"-mount-print

-Follow: If the find command encounters a symbolic link file, it will trace the file pointed to by the link.

-Cpio uses the cpio command to back up the files to the tape device.

-Newer file1! File2 searches for files whose change time is earlier than file1 but earlier than file2. For example, if the current time is, you want to find files whose change time is less than two hours, touch-t 07212140 dstamp, find. -newer dstamp-print

-Mtime-N + N: searches for files based on the file change time, for example: find/-mtime-5-print (find the file whose modification time is within 5 days in the system root directory)

-Type: search for a certain type of files (B-block device files; D-directory; C-character device files; P-pipeline files; l-Symbolic Link file F-common file), such as: Find/etc-type D-print-exec LS-l {}/;

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.