I have around 50 user folder under etc/main/ folder. Now i want to get 10 large space user folder detail.Note: I don't want sub-folder of each user..I am using Ksh script.  Example:  /etc/main$ ls -lrt user1  user2 user3 user4 user5 ......... user50   Expecting result:  9876800 user20  9666666 user49  8769999 user15  ....
disk space by individual user
shell script;ksh
Use du and sort: du -sk /etc/main/* |sort -nrThe arguments -sk to du tell it to report usage in kilobytes, and to sum the size of all the contents of the directory instead of reporting to each file.The arguments -nr to sort tell it to sort numerically and in reverse order so that you get the largest directory first.