Centos searches for files by file size

Source: Internet
Author: User
The find command in linux is used to find files. manfind can be used to find files that are omnipotent. Therefore, simply find the file according to the file size. Search for size from manfind and you can see the following information:-sizen [cwbkMG] Fileusesnunitsofspace. Thefollowingsuffixescanbeused: bfor512-bytebloc

The find command in linux is used to find files. man find can be used to find files that are omnipotent. Therefore, simply find the file according to the file size. Search for the size from man find. the following information is displayed:

-size n[cwbkMG]  File uses n units of space.  The following suffixes can be used:  b    for 512-byte blocks (this is the default if no suffix is used)  c    for bytes  w    for two-byte words  k    for Kilobytes (units of 1024 bytes)  M    for Megabytes (units of 1048576 bytes)  G    for Gigabytes (units of 1073741824 bytes)

Note:The default unit is B, which represents 512 bytes.So 2 indicates 1 K, and 1 M indicates 2048. if you do not want to convert it yourself, you can use other units, such as c, K, and M.

Example: find the file in the current directory with a size of 2048 (2 k) bytes

Find./-size 4 or find./-size 2048c or find./-size 2 K

If the above search file is equal to the specified size, can you query a file greater than or less than a specified value? the answer is yes, for example:

Search for files larger than 2 k,+ Indicates that the value is greaterFind./-size + 2048c find files smaller than 2 k,-Indicates lessFind./-size + 2048c-type f


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.