GREP to locate files of certain size - Redhat

This is a discussion on GREP to locate files of certain size - Redhat ; I would like to use GREP to to locate files on my system that are over 1gig in size. I want to search the entire system and then have this sorted alphabeticallly. How can I accomplish this? Would it be ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: GREP to locate files of certain size

  1. GREP to locate files of certain size

    I would like to use GREP to to locate files on my system that
    are over 1gig in size. I want to search the entire system and then
    have this sorted alphabeticallly. How can I accomplish this?

    Would it be a combination of GREP & Find or LOCATE?

    When would you use GREP over FIND? GREP over LOCATE?

    Guess you can smell newbie all over this huh? Any guidance would be
    appreciated.




  2. Re: GREP to locate files of certain size

    On Mon, 14 Mar 2005 15:07:43 -0500, wipt@kyro.net wrote:
    > I would like to use GREP to to locate files on my system that
    > are over 1gig in size.


    You can use find to find files based on size.

    man find for options.
    find / -size +1048000c -print -exec ls -al '{}' \;

  3. Re: GREP to locate files of certain size

    In article , wipt@kyro.net wrote:

    >I would like to use GREP to to locate files on my system that
    >are over 1gig in size.


    That's not the job for grep. You want to be using 'find'

    /bin/find / -type f -size 1000000 -print \;

    >I want to search the entire system and then have this sorted
    >alphabeticallly. How can I accomplish this?


    Pipe the output of the command above through sort

    >Would it be a combination of GREP & Find or LOCATE?


    find piped to sort

    >When would you use GREP over FIND? GREP over LOCATE?


    See the man pages. 'grep' searches for strings in text. 'locate' doesn't
    have size information. 'find' searches for files.

    >Guess you can smell newbie all over this huh? Any guidance would be
    >appreciated.


    Actually, it smells more like a homework problem. Guideance the
    man wants... go to http://tldp.org/guides.html and grab copies of
    the Bash Beginner's Guide, and the Advanced Base Scripting guide. The
    intro-linux guide is also useful.

    505446 Mar 2 14:21 Bash-Beginners-Guide.html.tar.gz
    120493 Mar 2 14:21 Bash-Beginners-Guide.txt.gz

    463927 Feb 9 16:07 abs-guide.html.tar.gz
    431751 Feb 9 16:07 abs-guide.txt.gz

    891537 Mar 2 14:40 intro-linux.html.tar.gz
    209913 Mar 2 14:40 intro-linux.txt.gz

    How 'bout that - all three are recently updated too.

    Old guy


+ Reply to Thread