find command to find first 20 filesystems as per size?

Hi
         Do we have find command to find first 20 filesystems as per size?
LVL 2
rammaghentharAsked:
Who is Participating?
 
woolmilkporcConnect With a Mentor Commented:
Rather use df instead of find, and sort by the Size column. Then use |  head -20, if you like.
0
 
PapertripCommented:
What exactly do you mean by filesystems?  Do you mean all filesystems listed in /etc/filesystems, all directories immediately under /, or something else?
0
 
woolmilkporcConnect With a Mentor Commented:
If you really mean "space used in filesystems" - try this:

df -m | grep -v Filesystem| sort -k3rn | tail -20 |awk '{printf "%20s\t%s MB\n", $NF, $3}'

If you mean "defined size of filesystems":

lsvg | lsvg -i -l | grep -v "TYPE" | grep -v ":" | grep -v N/A | sort -k3rn | head -20 |awk '{printf "%5s LPs\t%-20s\n", $3, $NF}'

Attention: The latter displays the size in logical partitions. Find this sze with "lsvg vgname" beneath "PP SIZE:".

wmp
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
woolmilkporcCommented:
Of course you can get the "defined size" with method 1 as well, by replacing "sort -k3rn" with "sort -k2rn" and "$3" with "$2"

By the way, in the first command I should have written "head -20" instead of "tail -20". Sorry.

wmp
0
 
rammaghentharAuthor Commented:
Hi papertrip
      you are correct filesystems you mean is correct one. Most of the critical filesystem is getting like /var, /tmp /.
I need to findout which file is consuming more space and need to do house keeping,

Hi Woolmilkpokji,
           I am unable to understand your comment.
SOrry for delayed response.
0
 
woolmilkporcConnect With a Mentor Commented:
Go to the filesystem resp. directory in question and issue

du -x -ma * | sort -n

You will see the files consuming the most space at the bottom of the list, with the size in MB in the first column.

If you want to see just the 20 biggest files/directories add "| tail -20" at the end of the command:

du -x -ma * | sort -n | tail -20

wmp


0
 
woolmilkporcConnect With a Mentor Commented:
This will give a more concise list (less "noise"):

du -x -ma . | sort -n | tail -20
0
 
rammaghentharAuthor Commented:
.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.