Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 03-13-2008, 10:43 AM   #1
LQ Newbie
Registered: Nov 2005
Location: Chennai
Distribution: RHEL4 , Slackware 10.2
Posts: 17

Rep: Reputation: 0
Post printing filesizes greater than 1 mb

Hi all ,
I need to print the filesizes and files in my home directory which are greater than 1 Mb . preferably both the filesizes and the file path
i tried

du -h ~ | awk '{print $1}' | grep M

It gives me just the first column , but i got all the indicator containing M as suffix , indicating they are greater than a MB .
then i tried

du -h | awk '{print $1 , $2}' | grep M

But it grep's all the file names which contains the letter 'm' in it and the out put contains files like .
68K ./Equitywatch/HTMLs/Appa
92K ./Equitywatch/HTMLs/Ramesh
all I need is like , it should grep the 'M's from the first column , and also prints out both first and second column .

14M ./.thunderbird/vtqnx8nq.default/ImapMail/mailhost
14M ./.thunderbird/vtqnx8nq.default/ImapMail
for the entire home directory

can some one helps me out framing the arguments so that the out willbe like the one above
Old 03-13-2008, 10:53 AM   #2
Senior Member
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
find . -size +1M -exec ls -lh {} \;
Old 03-13-2008, 11:16 AM   #3
LQ Newbie
Registered: Nov 2005
Location: Chennai
Distribution: RHEL4 , Slackware 10.2
Posts: 17

Original Poster
Rep: Reputation: 0
Thanks Agrouf .

Merci ..

That was great
i used this to achieve my kinda output .

find . -size +1M -exec ls -lh {} \; | awk '{print $5 , $8}'

Thanks for the swift response .


awk, du, grep

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
Reading a CD with filenames greater than 8 chars shazam75 Linux - Software 4 10-11-2007 03:37 AM
80x25 and Greater... SpEcIeS Debian 4 02-07-2005 12:10 PM
OpenOffice exporting really huge PDF filesizes? R00ts Linux - Software 1 11-08-2004 06:05 AM
No Greater Gift ... moorege Member Intro 0 08-24-2003 02:02 PM
getting filesizes.. ichbinesderelch Linux - General 2 08-17-2003 05:11 PM > Forums > Linux Forums > Linux - Newbie

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

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