Shell programming (2)-Use Find and xargs

Source: Internet
Author: User

1,Find Command Options
The f I n d command has many options or expressions. Each option follows a horizontal bar -.
-Name: searches for files by file name.
-Perm searches for files based on the file permissions.
-Prune can use this option to make the f I n d command not be found in the currently specified directory. If the-d e p t h option is used at the same time, the-P r u n e option is ignored by the f I n d command.
-The user searches for files based on the file owner.
-The group searches for files based on the group to which the files belong.
-Mtime-N + N: Find the file based on the file change time.-N indicates that the file change time is earlier than N days, and + N indicates that the file change time is earlier than N days. The f I n d command also has the-a t I m e and-C t I m e options, but they are similar to the-M t I m e option, so here we will only introduce the-M t I m e option.
-Nogroup: Find the file with no valid group, that is, the group to which the file belongs does not exist in/e t C/g r o u p S.
-Nouser: Find the file without a valid owner, that is, the owner of the file does not exist in/e t C/p a s w d.
-Newer file1! File2 searches for files whose change time is newer than file f I l e 1 but older than file f I L E 2.
-Type: search for a certain type of files, such:
B-block device files.
D-directory.
C-character device file.
P-MPs queue file.
L-Symbolic Link file.
F-common file.
-Size N [c]: searches for files with a length of N blocks. If a file contains C, the file length is measured in bytes.
-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 be found in the configuration file/e t C/f s t a B, this configuration file contains information about the file system in the system.
-Mount does not span the m o u n t point of the file system when searching for files.
-Follow: If the f I n d command encounters a symbolic link file, it traces the file to which the link points.
-Cpio uses the C p I o command for matching files to back up these files to the tape device.

Execute shell commands using exec or OK. The E x e c option is followed by the command to be executed, followed by a pair of characters {}, a space, a/, and a semicolon. 2, X a rg s command: The f I n d command passes the matched file to the X A RG s command, while the X A RG s command only obtains part of the file, not all of it at a time, unlike the-e x e c option. In this way, it can first process the first part of the obtained files, then the next batch, and continue like this.
Related Article

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.