Ieškome daugiausiai failų turinčius katalogus

Surandame katalogus, kurie turi daugiausiai failų:

Šaltinis: http://askubuntu.com/a/316194

#!/bin/bash

if [ $# -ne 1 ];then
  echo "Usage: `basename $0` DIRECTORY"
  exit 1
fi

echo "Wait a moment if you want a good top of the bushy folders..."

find "$@" -type d -print0 2>/dev/null | while IFS= read -r -d '' file; do 
    echo -e `ls -A "$file" 2>/dev/null | wc -l` "files in:\t $file"
done | sort -nr | head | awk '{print NR".", "\t", $0}'

exit 0

Dar vienas būdas:

Šaltinis: http://unix.stackexchange.com/a/117094/100727

find / -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n