简体   繁体   中英

How to use ls, grep, and wc to produce a list of all files in the /usr/bin directory that are at least 10,000,000 bytes in size?

我想知道需要在 PuTTY 上使用什么命令才能获得此结果。

That can be done directly with find :

find /usr/bin -type f -size +9999999c

+ matches files larger than the given size. - is less than.

The c unit is for bytes. You can also use k for kilobytes, M for megabytes, and G for gigabytes.

I dont know about wc and grep but you can create script that will help using below command.

ls -lh /usr/bin | awk '{print $5,$9}'

it will post your output like this: 1.4K anaconda-ks.cfg 17M book1 39M Book2 52 Book3 26M Book4

After that you can script that will help you to filter out [Statement] size with filename.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM