du - Disk Usage for only files and NOT directories. | 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 !!

du - Disk Usage for only files and NOT directories.

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-01-2009
RRVARMA's Avatar
RRVARMA RRVARMA is offline
Registered User
 
Join Date: Feb 2008
Last Activity: 22 February 2013, 2:10 AM EST
Location: Bangalore, INDIA
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
MySQL du - Disk Usage for only files and NOT directories.

Hello,

Could any one help me how to find the Disk Usage for all the files in the running directory and the sub directories without the disk usage of the directory. I mean to say, i need only the file names without the size of the directories.

See, i used this command

du -a .|sort -nr|more

here i'm getting even the size of directories. I need only the files in each directory. Could you help me please. Thanks in advance.

Note: I'm using MP-RAS and i find du -l doesn't work out.

------------------------------------
Like to add some more..

I found that ls -lu gives the files in the order that they were accessed (even if it is read and not modified). I'm trying to find some command or simple logic where i can filter the filenames that are large in size and NOT accessed for a longer duration of time.

Even a discussion or clue will also be appreciated. (but it should be genuine please).
Thanks a lot.

Last edited by RRVARMA; 07-01-2009 at 05:13 AM.. Reason: Adding some more information.
Sponsored Links
    #2  
Old 07-01-2009
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 31 October 2014, 2:57 PM EDT
Location: NM
Posts: 10,258
Thanks: 285
Thanked 803 Times in 747 Posts
Let's say you want to see files larger than 100 blocks (block size varies by filesystem but for this example assume 1024 bytes) with an access time older than 15 days.

Code:
find /path/to/files  -type f -atime +15 -size +100 -exec ls -lu {} \;

Sponsored Links
    #3  
Old 07-02-2009
DukeNuke2's Avatar
DukeNuke2 DukeNuke2 is offline Forum Staff  
Soulman
 
Join Date: Jul 2006
Last Activity: 31 October 2014, 5:45 PM EDT
Location: Berlin, Germany
Posts: 5,416
Thanks: 55
Thanked 231 Times in 224 Posts
you can also use a little script like:


Code:
#!/bin/ksh
for i in $(ls)
do
 if [ -f $i ]
 then
  du -sh $i
 fi
done
exit 0

    #4  
Old 07-09-2009
RRVARMA's Avatar
RRVARMA RRVARMA is offline
Registered User
 
Join Date: Feb 2008
Last Activity: 22 February 2013, 2:10 AM EST
Location: Bangalore, INDIA
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
got part of it..

Hi,,

I got part of the thing done..

i gave this command..

du -as|sort -nr|more

and got all the files.. in the descending order of the file usage.. that was cool.. now wat i need is to bring them in an order these files were accessed..

thanks a lot for your contribution..
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
How to trace the big files causing high disk usage ailnilanjan UNIX for Dummies Questions & Answers 1 12-17-2008 10:50 AM
current CPU usage, memory usage, disk I/O oid(snmp) S_venkatesh Solaris 2 12-13-2008 05:19 AM
how can I find cpu usage memory usage swap usage and logical volume usage alert0919 HP-UX 3 12-02-2008 01:38 PM
disk usage rrs Shell Programming and Scripting 1 04-13-2007 03:48 AM
disk usage (df vs du) gfhgfnhhn UNIX for Advanced & Expert Users 8 09-23-2006 08:06 PM



All times are GMT -4. The time now is 12:44 AM.