How to find commands in Linux common use

Source: Internet
Author: User
Tags file size file system safe mode root directory linux

Find a directory with name Conf

#find/directory-type d-name conf

Note that the type may be b,c,d,l ...

Find files with permissions of 755

#find/directory-perm 755-print

If you use octal, you can use the

#find/directory-perm-007-print (same as in chmod)

Find files that belong to kt

#find/directory-user Kt-print

Find a file with a group of KT

#find/directory-group Kt-print

Find a file with the name file

#find/directory-name file

Find a file size 0

#find/directory-size 0

Ignore a directory:

#find/directory-name "/directory Name"-prune-o-print

Find files that have been deleted by the master account:

#find/Directory-nouser-print

Find files by change time

#find/directory-mtime-5-print Unit is 5, find files that have changed within 5th

Find files within 3rd of the change time

#find/directory-mtime +3-print

Find changes longer than file1 new but older files than file2

#find/directory File1! -newer file2-exec ls-l {} \;

Not only querying the root directory, but querying subdirectories

#find/directory-name File-depth-print

Query only within the current file system and not into other file systems

#find/directory-name File-mount-print

Operation of the found file with exec

The operation "Ls-l" is performed #find/directory-type f-exec ls-l {} \//-exec ls-l {} \;

In exec Safe mode, prompt before deletion

#find/directory-name "*.log"-mtime +5-ok rm {} \//So prompts before deleting files

To obtain a hard link based on the inode number

#find/directory-inum inode number

The files found by find can be executed using the-exec execute instruction {} \, or you can use the | Xargs instructions.

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.