The face question of the shell

Source: Internet
Author: User

on the Internet to see a test shell problem--the statistics of a folder size greater than 7MB the folder

Okay, I'll do it. Deep, personal feel, this problem is the main test of the regular use of the Linux proficiency (I am not very familiar with, haha), the topic to statistics, mainly used to two steps: Find + count, as long as the folder is more than 7MB to find out folders, and then can count. Find out what command to use, you can use Find, find out a folder with a size larger than 7MB folder with

Find. -size +7m-type D  #在当前目录下查找

Then, the count of what to use, you can use WC, here only to calculate the number of rows, because find to match the criteria of the folder filter out, to count the number of files, in fact, is the statistics of the number of rows,

Find. -size +7m-type D | Wc-l
in this way, the topic is basically solved. Of course, you can write that.

Find. -size +7m-type D | awk ' End{print NR} '
The answer is not the only one, by the way, there are interesting articles about find ,

Mommy, I found it!-15 practical Linux Find Command Examples (Chinese translation)with regard to the number of Linux statistics rows,

Linux statistics line count method and efficiency test



The face question of the shell

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.