How to find Top 10 Big files/Folder in the system? | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

How to find Top 10 Big files/Folder in the system?

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-01-2011
pinga123 pinga123 is offline
Registered User
 
Join Date: Sep 2009
Last Activity: 27 January 2014, 2:06 AM EST
Posts: 388
Thanks: 86
Thanked 3 Times in 3 Posts
How to find Top 10 Big files/Folder in the system?

Used following command to find out the top 10 big files in the system But it is having its own limitations as it consider files and directories both.

Code:
du -a / | sort -n -r | head -n 10

I would like to get the following information.

1)top 10 big files.
2)top 10 big directories.

File size with human readable output.
as executing

Code:
# du -a / | sort -n -r | head -n 10
5546667 /
2755464 /usr
2211844 /install
2136888 /install/linux-3.0-rc1
1508756 /usr/share
834836  /install/linux-3.0-rc1/drivers
716544  /usr/lib
365224  /lib
331924  /lib/modules
317132  /usr/share/locale

Giving me correct output
but when i add -h option for human readable file size its giving me wrong output.
Confused why its happening any clue?

Code:
# du -ha / | sort -n -r | head -n 10
1020K   /lib/modules/3.0.0-rc1/kernel/drivers/net/e1000/e1000.ko
1020K   /install/linux-3.0-rc1/drivers/net/e1000/e1000.ko
1016K   /usr/src/kernels/2.6.18-92.el5-i686/scripts/kconfig
1016K   /usr/share/system-config-selinux
1016K   /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Encode/TW
1016K   /lib/modules/3.0.0-rc1/kernel/sound/core/snd.ko
1016K   /lib/modules/3.0.0-rc1/kernel/drivers/net/tulip/tulip.ko
1016K   /install/linux-3.0-rc1/sound/core/snd.ko
1016K   /install/linux-3.0-rc1/drivers/net/tulip/tulip.ko
1012K   /usr/lib/python2.4/distutils/command

Sponsored Links
    #2  
Old 06-01-2011
kumaran_5555 kumaran_5555 is offline
Registered User
 
Join Date: Jul 2008
Last Activity: 27 August 2012, 1:46 AM EDT
Location: India
Posts: 342
Thanks: 9
Thanked 48 Times in 47 Posts
To top 10 big files


Code:
 ll -R|grep ^-|sort -nrk5|head

Top ten big directories


Code:
 ll -R|grep ^d|sort -nrk5|head

Sponsored Links
    #3  
Old 06-01-2011
pinga123 pinga123 is offline
Registered User
 
Join Date: Sep 2009
Last Activity: 27 January 2014, 2:06 AM EST
Posts: 388
Thanks: 86
Thanked 3 Times in 3 Posts
Quote:
Originally Posted by kumaran_5555 View Post
To top 10 big files


Code:
 ll -R|grep ^-|sort -nrk5|head

Top ten big directories


Code:
 ll -R|grep ^d|sort -nrk5|head

You can't execute it on system wide as its giving lot of error like

Code:
ls: cannot read symbolic link

    #4  
Old 06-01-2011
kumaran_5555 kumaran_5555 is offline
Registered User
 
Join Date: Jul 2008
Last Activity: 27 August 2012, 1:46 AM EDT
Location: India
Posts: 342
Thanks: 9
Thanked 48 Times in 47 Posts
what about using find instead of
Code:
ls -R|grep ^-

like,


Code:
find . -type f  -exec ls -l {} \;

Sponsored Links
    #5  
Old 06-01-2011
pinga123 pinga123 is offline
Registered User
 
Join Date: Sep 2009
Last Activity: 27 January 2014, 2:06 AM EST
Posts: 388
Thanks: 86
Thanked 3 Times in 3 Posts
I guess this might do the work
For directories.


Code:
find . -type d  -exec ls -ld {} \; |sort -nk5|head

For Files


Code:
find . -type f  -exec ls -ld {} \; |sort -nk5|head

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
find files on first level folder iga3725 UNIX for Dummies Questions & Answers 8 07-28-2010 05:04 AM
Find all text files in folder and then copy to a new folder cgkmal Shell Programming and Scripting 4 06-20-2009 02:12 PM
To find files with specific dates and cp another folder. *Jess* UNIX for Dummies Questions & Answers 2 03-17-2009 09:23 PM
find how many files are in use in a folder smongam Shell Programming and Scripting 3 01-22-2009 07:00 PM
How to find files in current folder only? Hangman2 Shell Programming and Scripting 7 01-04-2009 02:31 AM



All times are GMT -4. The time now is 12:28 PM.