Find the top 5 small file

Discussion in 'Linux' started by vasudha, Jul 17, 2009.

  1. vasudha

    vasudha New Member

    Technique is same as finding the bigger files, but the only difference the sort is ascending order.

    # find . -type f -exec ls -s {} \; | sort -n | head -5

    In the above command, most probably you will get to see only the ZERO byte files ( empty files ). So, you can use the following command to list the smaller files other than the ZERO byte files.

    # find . -not -empty -type f -exec ls -s {} \; | sort -n | head

Share This Page