LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices



Reply
 
Search this Thread
Old 03-13-2008, 10:43 AM   #1
sknowonweb
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 .

Like
[
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
Agrouf
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
sknowonweb
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 .
 
  


Reply

Tags
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 LinuxQuestions.org Member Intro 0 08-24-2003 02:02 PM
getting filesizes.. ichbinesderelch Linux - General 2 08-17-2003 05:11 PM


All times are GMT -5. The time now is 03:53 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