How can I get the size of all files and all files in its subdirectories using the du command. I am trying the following command to get the size of all files and files in subdirectories find. The operating system is AIX 6. Improve this question. Rui F Ribeiro Shardul Upadhyay Shardul Upadhyay 1 1 gold badge 6 6 silver badges 5 5 bronze badges.
Add a comment. Active Oldest Votes. I usually use the -exec utility. Like this: find. The following snippet sorts the list, largest first: find. Improve this answer. Gilles 'SO- stop being evil' k gold badges silver badges bronze badges. I'd go with this answer if you don't have access to find -print0 or other GNU features. Thanks, this works out great especially since du offers a flag for size in different units. Is that an option for du or for find? To print file size along with with file paths for files larger than 0 Bytes use this command,.
Your email address will not be published. This site uses Akismet to reduce spam. Learn how your comment data is processed. Table of Contents Syntax of find command to find files bigger than given size in Linux. Find files larger than 4gb in Linux. Find files larger than 1gb in Linux. Find files larger than MB in Linux. Take a skills assessment today. Tyler is a community manager at Enable Sysadmin, a submarine veteran, and an all-round tech enthusiast! More about me. Relive our April event with demos, keynotes, and technical sessions from experts, all available on demand.
Enable Sysadmin. Linux commands: du and the options you should be using. The lowly du command has a lot to offer space-exploring sysadmins looking to understand their Linux system storage.
Topics: Linux. Tyler Carrigan Tyler is a community manager at Enable Sysadmin, a submarine veteran, and an all-round tech enthusiast! On Demand: Red Hat Summit Virtual Experience Relive our April event with demos, keynotes, and technical sessions from experts, all available on demand.
Watch Now. Related Content Image. Writing Python applications, building Linux labs, and more tips for sysadmins.
Check out Enable Sysadmin's top 10 articles from December Posted: January 7, Author: Vicki Walker Red Hat. Viewed 47k times. This is what I'm using: find. Improve this question. If all your files are likely to fit on one command line, then this will work: find.
Add a comment. Active Oldest Votes. Why not this? Improve this answer. So you can say: find. Actually du will give you the total of a list of files if you pass it the -c option but there could easily be too many files. Should add -type f otherwise it will include current directory. This gives incorrect results without -type f as suggested above — ollybee.
This solution has many flaws, and should be never used: 1 Bug mentioned in other comments 2 It is very slow, as it executes du for every single file 3 awk may not be able to handle large enough integers Please revoke this as accepted answer and accept the answer by user The simplest and fastest way is this: find.
0コメント