Warning: DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity, line: 2 in /srv/users/serverpilot/apps/benlobaughnet/public/blog/wp-content/plugins/auto-amazon-links/amazon.php on line 74
If you need to find out what the largest files are in a directory and subdirectories here is a command you can run that will find the top 5 largest files.
find . -type f | sed 's/.*/"&"/' | xargs ls -Slh | head -n 5
- find . -type f: Find all files in this directory and below
- sed ‘s/.*/”&”/’: Put double quotes around the files. xargs can handle this itself, however not all implementations do, this method is safer.
- xargs ls -Slh: Using the filenames from 1 list them all sorted by size.
- head -n 5: Show the output of the first 5 rows. Which becomes the 5 largest files because ls sorted the output.