Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command to calculate size of folder #91

Open
martinwholtmon opened this issue May 2, 2024 · 2 comments
Open

Add command to calculate size of folder #91

martinwholtmon opened this issue May 2, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation maybe

Comments

@martinwholtmon
Copy link
Owner

martinwholtmon commented May 2, 2024

This command will give you the total size of the directory, following all symbolic links, and display the size in GiB with one decimal point precision.

du -Ls . | awk '{printf "%.1f GiB\n", $1 / 1024 / 1024}'
@martinwholtmon martinwholtmon added documentation Improvements or additions to documentation maybe labels May 2, 2024
@martinwholtmon
Copy link
Owner Author

martinwholtmon commented May 2, 2024

Looking at the manual, the output is in power of 1024, meaning KiB. So, when we convert with KiB / 1024 / 1024, the output is in GiB. Due to this, the precision should be increased to two decimals:

du -Ls . | awk '{printf "%.2f GiB\n", $1 / 1024 / 1024}'

@martinwholtmon
Copy link
Owner Author

find -L . -type f | wc -l to find number of files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation maybe
Projects
None yet
Development

No branches or pull requests

1 participant