I can sort the files either in descending order (of any size) or list all files greater than 1000 bytes but don't know how to sort files greater than 1000 bytes in a user specified directory.
List files greater than 1000 bytes :
for i in "$1/*" # $1 expects a directory name
do
if [ `wc -c $i` -gt 1000 ]
echo $i
done
List files in descending order of size :
`ls -lhS`
But how do I list all files greater than 1000 bytes in descending order of size?
grep
here, you can get it withawk
itselfls -lpSa| awk '! /\// && $5>1000'
+ Please don't parse ls output. – αғsнιη Sep 27 '17 at 07:39