Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-24-2011, 03:27 PM   #1
LQ Newbie
Registered: Nov 2010
Posts: 14

Rep: Reputation: 0
DU command - summary of files and folders

Hi guys,

I use the following command to find files which are older than 60 days:
find /myfolder/* -mtime +60 > /myfolder/file.list

Now I want to find out the file size of all files contained in file.list in summary using the du command:
less /myfolder/file.list | xargs du -sh

The du command prints the file sizes of every single file but not the summary and this is actually what I want.

Does anyone have an idea?

Old 06-24-2011, 04:21 PM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
If you read the manpage you'll see the -c option for a total.
Old 06-24-2011, 05:11 PM   #3
Senior Member
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
I think that du doesn't work on file list, but in the directory.
find /mydir/* -mtime -60 | xargs du -hs 
du: invalid option -- p
du: unrecognized option `--dport'
du: invalid option -- j
Try `du --help' for more information.
xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option
so there is a catch probably how to do it with a file list?

otherwise "du" gives me:
du /etc/postfix/ -hcs
564K    /etc/postfix/
564K    total

Last edited by lithos; 06-24-2011 at 05:12 PM.
Old 06-24-2011, 05:18 PM   #4
LQ Newbie
Registered: Nov 2010
Posts: 14

Original Poster
Rep: Reputation: 0
I was so focused by the -s parameter that indeed doesn't work with the retrieving files from a file method...

In addition, the command 'grep total' turns this in a nice piece of work I think
less /myfolder/file.list | xargs du -csh | grep total

I can work with that...


Last edited by ktfreak; 06-25-2011 at 07:43 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Recovery deleted folders and files when using rm -rf command ytd Linux - General 6 04-06-2010 06:59 AM
find -exec command to recursively delete files and folders in folders with X name Joan Murt Linux - Newbie 2 07-08-2009 04:35 PM
Command to copy files/folders but skip bad/corrupt files?? leemoreau Linux - Newbie 2 04-02-2007 02:27 PM
what is the command to delete files and folders quickly. ravi Linux - General 1 03-13-2007 12:09 PM
moving files and folders thru command line JROCK1980 Linux - General 2 02-16-2004 06:55 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:36 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration