LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 04-17-2007, 02:10 AM   #1
packets
Member
 
Registered: Oct 2005
Posts: 285

Rep: Reputation: 30
how to show size of files in FIND command


Hi to all!

how can i show the size of files if I use the FIND command? Below is the ex:

find /home/*/Maildir -size 5M -type f

It shows the filename with 5M files size but doesn't print its size.

I read the man page but could not locate the one I'm looking for.

TIA
 
Old 04-17-2007, 02:44 AM   #2
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 30
The man page you want is

Code:
man find
Look at the -printf and -print options. You want something like this:

Code:
find /home/*/Maildir -size 5M -type f -printf "%s " -print
Hope this helps.
 
Old 04-17-2007, 03:05 AM   #3
packets
Member
 
Registered: Oct 2005
Posts: 285

Original Poster
Rep: Reputation: 30
thanks! Now i know what's wrong in my print command
 
Old 04-17-2007, 05:24 PM   #4
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 59
If you want to see all files above 5M, precede the size with a (+) "+5M", to see all files below, (-), with the command you originally used, you will only see files exactly 5M.
 
Old 04-17-2007, 09:20 PM   #5
packets
Member
 
Registered: Oct 2005
Posts: 285

Original Poster
Rep: Reputation: 30
However the problem is when I search for -size 5M, it also shows the 4.xM files. Is there a possibility that it only shows all 5.xM files?

BTW: this is my command

find /home/*/ -size 5M -type f -exec du -h {} \; OR

find /home/*/ -size 5M -type f -print0 | xargs -0 du -h
 
Old 04-17-2007, 11:49 PM   #6
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 59
By rights it is supposed to show what you specify. Even with the (-h) option after du. The (M) in the size is for a true megabyte.
This is from the find man pages:
Code:
Numeric arguments can be specified as

       +n     for greater than n,

       -n     for less than n,

       n      for exactly n.
 
  


Reply


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux/Unix Command to find RAM size? ssnkumar Linux - General 9 09-09-2009 10:38 AM
The command to find the size of the partitons Gins Linux - General 18 10-29-2006 02:27 PM
what command can i use to find files of a certain size? abutzki Linux - Newbie 2 01-31-2006 08:43 AM
command to find size of a dir Longinus Linux - Newbie 3 08-01-2004 09:19 PM
Command to find total file size satimis Linux - Newbie 1 01-22-2004 12:19 PM


All times are GMT -5. The time now is 09:38 PM.

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