Contents[Show]

1. How many files and folders are there in a given folder?

 
# cd /var/www/html/owncloud/data
 
# for t in files links directories; do echo `find . -type ${t:0:1} | wc -l` $t; done 2> /dev/null
217 files
0 links
244 directories

 

2. How big is the folder?

2.1. Alternative 1

# du -h /var/www/html/owncloud/data
.
.
.
156M    /var/www/html/owncloud/data

 

2.2. Alternative 2

# cd /home
# du -hs * | sort -hr
21G sorin
20G kristina
16K lost+found

 

 

 Source: https://superuser.com/questions/554319/bash-display-each-sub-directory-size-in-a-list-format-using-1-line-command