Find and search for Linux commands

Source: Internet
Author: User

Find and search for Linux commands
Command: find
Search
It is a real-time Feature and does not require a database. It is relatively slow.
1. Recursively search for files in a specified path
2. Search by various criteria
3. Support for further instructions on searched files


Syntax: # find [path] [parameter] [expression]
Common Parameters

-User can search for files based on the file owner # find/root-user root searches for files whose owner is root in the root directory
-Group: searches for files according to the file group # find/root-group root searches for files whose group is root in the/root folder
-Nouser: find files without the file owner, for example, some Trojans, but note that some linux files do not have users # find/etc-nouser
-Nogroup: searches for files without groups. The principle is the same as-nouser # find/etc-nogroup.
-Name: Search for files by file name # find/ect-name services search for files named service in etc
-Size: Search for files based on the file size # find/etc-size + k search for files larger than 1 MB
-Type: Find the file based on the file type. For general files, use f, character c, block file B, Directory d, link l # find/root-type f to find files whose type is normal
-Atime + n: files accessed or executed for more than n days
-Ctime + n files whose write and inode attributes (change owner, permission, or connection) are longer than n days-mtime + n files whose write time is longer than n days
-Exec outputs the find search result to the subsequent command as the input. For example. # Find. /-mtime + 10-exec rm-rf {}\; find the file created in the current directory for more than 10 days and delete it. In this command, {} is used as an alternative to the previously found file, and "\" is "; ", otherwise the shell will use the semicolon as the end of the line command.
-Perm searches for Objects Based on their permissions. # find/home-perm 600 searches for objects with a permission of 600 and displays hidden objects.


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.