diff --git a/README.md b/README.md index 2f7a3e6..35a3490 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/). For a steady stream of TILs from a variety of rocketeers, checkout [til.hashrocket.com](https://til.hashrocket.com/). -_593 TILs and counting..._ +_594 TILs and counting..._ --- @@ -559,6 +559,7 @@ _593 TILs and counting..._ - [Search Man Page Descriptions](unix/search-man-page-descriptions.md) - [Securely Remove Files](unix/securely-remove-files.md) - [Show Disk Usage For The Current Directory](unix/show-disk-usage-for-the-current-directory.md) +- [Show The Size Of Everything In A Directory](unix/show-the-size-of-everything-in-a-directory.md) - [SSH Escape Sequences](unix/ssh-escape-sequences.md) - [SSH With Port Forwarding](unix/ssh-with-port-forwarding.md) - [Sort In Numerical Order](unix/sort-in-numerical-order.md) diff --git a/unix/show-the-size-of-everything-in-a-directory.md b/unix/show-the-size-of-everything-in-a-directory.md new file mode 100644 index 0000000..eb0a89d --- /dev/null +++ b/unix/show-the-size-of-everything-in-a-directory.md @@ -0,0 +1,14 @@ +# Show The Size Of Everything In A Directory + +The `ls` command will list everything in a given directory. The `du` +command is used to display disk usage statistics -- with the `-sh` flag, it +will display the file size in a human readable format. + +We can combine these two commands with `xargs` to get a listing of the sizes +of everything in a directory. + +``` +ls | xargs du -sh +``` + +See `man du` and `man xargs` for more details.