Find a linux Command every day

Source: Internet
Author: User


The main function of the find command is to find files or directories in the system. The common form of the find command is: find pathname-options [-print-exec-OK] print, which outputs matching files to standard output. The default value is standard output, therefore, do not write exec to execute the shell command provided by this parameter on the matching file, in the form of 'command' {}\; OK is similar to exec, Which is safer. You need to confirm each step. 1.-name match based on the file name. Example: find ~ -Name "test.txt": Check the test.txt file in the homedeskand subdirectory. Find. -name "[a-z] [A-Z] [0-9] [0-9] *" find in the current path and subdirectory, A file that starts with a lowercase letter, an uppercase letter, and two digits. Www.2cto.com find/-name "*. txt" to find all txt files. 2.-perm (permission) matches the permission. For example, find.-perm 777 searches for all files with 777 permissions under the current and sub-directories. (777 for more information, see chmod) find.-perm-777. + Is less than or equal. 3.-The user matches the user. For example, find.-user abc searches for files of the abc owner. 4.-nouser: Search for files that have been deleted by the primary account. For example, find.-nouser 5.-group,-nogroup is similar to user and nouser. 6.-mtime is matched based on the change time. For example, find.-mtime-3 days or less find.-mtime + 4 4 days ago 7.-newer matches with the change time. For example, find.-newer abc changes the time for a new file than the abc file. Find.-newer abc! -Newer 123-exec ls-l {}\; detailed information of files whose modification time is newer than abc but older than 123 .! Is not logical. Www.2cto.com 8.-type matches the file type. File type (B: block device file d: directory c: character device file p: Pipeline file l: Symbolic Link file f: common file) for example: find. -type f: Search for Common files. 9.-size is matched based on the file length. For example, find.-size + 000000c files larger than 1 MB in size. Note that c after the number represents byte measurement. Find.-size 10 files are equal to 512 files. If the number is not followed by c, it indicates that it is measured in blocks (1 block = 512 bytes. 10. It can also be used with the xargs command (for more information ). Author: CrazyNemo

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.