Skip to content

Instantly share code, notes, and snippets.

@danuw
Created August 21, 2024 13:29
Show Gist options
  • Save danuw/436d62d063058b721d39eaea0f90949a to your computer and use it in GitHub Desktop.
Save danuw/436d62d063058b721d39eaea0f90949a to your computer and use it in GitHub Desktop.
du -h * | awk '$1 ~ /[0-9]+M/ && $1+0 > 20 {print $0}' | sort -h | uniq

This command does the following:

  • du -h *: Lists the sizes of all files and directories in human-readable format.
  • awk '$1 ~ /[0-9]+M/ && $1+0 > 20 {print $0}': Filters the output to only include lines where the size is in megabytes and greater than 20MB.
  • sort -h: Sorts the filtered results in human-readable format.
  • uniq: Removes any duplicate lines from the sorted output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment