Linux
Get a list of files over 1GB in size from subfolders.
du -h | awk '$1 ~ /[0-9]+G/ || ($1 + 0) >= 1000' | sort -hr # using awk
du -h | grep '[0-9]\+G' # using grep
grep is suitable for quick text searches, while awk is better for calculations, pattern matching, and more advanced data processing.
The reason for adding + 0 after $1 is to convert the string to a number, as awk always treats fields as strings by default.
Last updated on