Find the answer to your Linux question:
Results 1 to 3 of 3
Hello, I am missing something obvious here...I know how to display file sizes which are greater than a certain limit, say 50MB by doing this find . -size +50000k But ...
  1. #1
    Just Joined!
    Join Date
    Mar 2009
    Posts
    9

    finding and printing size of files

    Hello,
    I am missing something obvious here...I know how to display file sizes which are greater than a certain limit, say 50MB by doing this

    find . -size +50000k

    But I am also interested in printing the size of the file when the above command gets executed. I have tried

    find . -size +50000k | xargs ls -l
    find . -size +50000k -print | ls -l
    find . -size +50000k -type f -exec ls -l {}\;

    When I run the above commands, it will print the directory names under the current directory. What am I missing here? Thanks in advance.

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,695
    Put a space between the } and \

    Code:
    find . -size +50000k -type f -exec ls -lh {} \;
    -rw------- 1 root root 256M 2009-05-19 14:11 ./sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource0
    -rw------- 1 root root 256M 2009-05-19 14:11 ./sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource0_wc
    Google "find exec example" for more info.

  3. #3
    Just Joined!
    Join Date
    Mar 2009
    Posts
    9
    Thanks. find . -size +50000k -type f -exec ls -l {} \; did the trick.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...