Created
June 13, 2022 08:57
-
-
Save jazlopez/ba7c3f6303f022b0a3cf493de392a49c to your computer and use it in GitHub Desktop.
OSX compatible script: head larger files under current directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # ----------------------------------------------------------------- | |
| # OSX compatible script: head larger files under current directory | |
| # Jaziel Lopez 2022 | |
| # ----------------------------------------------------------------- | |
| function _head_large_files_(){ | |
| [ -z "$1" ] && { HEAD_MAX=10 } || HEAD_MAX="$1"; | |
| find . ! -type d -exec du -sh {} > /tmp/.size.files.tsv \; | |
| sort -rh /tmp/.size.files.tsv | head -"$HEAD_MAX" | |
| rm /tmp/.size.files.tsv | |
| } | |
| alias large-files=_head_large_files_ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment