• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 372
  • Last Modified:

find command to find first 20 filesystems as per size?

Hi
         Do we have find command to find first 20 filesystems as per size?
0
rammaghenthar
Asked:
rammaghenthar
  • 5
  • 2
4 Solutions
 
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
 
woolmilkporcCommented:
Rather use df instead of find, and sort by the Size column. Then use |  head -20, if you like.
0
 
woolmilkporcCommented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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
 
woolmilkporcCommented:
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
 
woolmilkporcCommented:
This will give a more concise list (less "noise"):

du -x -ma . | sort -n | tail -20
0
 
rammaghentharAuthor Commented:
.
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now