The command you are trying is readable to me. However, you can make use of the file utility with the find as below.
find / -maxdepth 10 -size +100000 -exec sh -c 'file -b {} | grep text &>/dev/null' \; -print
Another way to do this is using the below command.
du -BM / | sort -nr
The above command will give you the files in the sorted file size.
If you are using coreutils > 7.5, you can issue the below command to list the files by sizes.
du -ah / | grep -v "/$" | sort -h
In my machine, I did not had the sort -h
option available.
As you had mentioned in the comment, your human readable format is the file should have the size in kb, mb or gb. I would go with the second command that I had posted as the answer. The output that I got when I used it in my system is,
du -BM /home/ramesh/chk1/ | sort -nr
50M /home/ramesh/chk1/
21M /home/ramesh/chk1/Hierarchical_Clustering_Working
3M /home/ramesh/chk1/checking_files
1M /home/ramesh/chk1/checking/checking2
1M /home/ramesh/chk1/checking/checking1
1M /home/ramesh/chk1/checking/asdf
1M /home/ramesh/chk1/checking
file
utility withfind
. – Ramesh Apr 11 '14 at 15:28