Skip to content

Instantly share code, notes, and snippets.

@jazlopez
Created June 13, 2022 08:57
Show Gist options
  • Select an option

  • Save jazlopez/ba7c3f6303f022b0a3cf493de392a49c to your computer and use it in GitHub Desktop.

Select an option

Save jazlopez/ba7c3f6303f022b0a3cf493de392a49c to your computer and use it in GitHub Desktop.
OSX compatible script: head larger files under current directory
#!/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