LinuxQuestions.org
Review your favorite Linux distribution.
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 06-20-2013, 07:18 AM   #1
rookie11
LQ Newbie
 
Registered: May 2013
Posts: 4

Rep: Reputation: Disabled
du -hx


du -hx /dir or mountpoint will display all the subsequent directories and their size. e.g
8.0K /usr/share/locale/got/LC_MESSAGES
8.0K /usr/share/locale/ie/LC_MESSAGES
8.0K /usr/share/locale/fiu/LC_MESSAGES
8.0K /usr/share/locale/kaa/LC_MESSAGES
7.8M /usr/share/locale/fr/LC_MESSAGES
8.0K /usr/share/locale/ii/LC_MESSAGES
96K /usr/share/locale/es_PR/LC_MESSAGES

I want use command du -hx /dir then grep output of dir whose size is in Gb or G. Plz tell me how to do it.
 
Old 06-20-2013, 07:44 AM   #2
mddnix
Member
 
Registered: Mar 2013
Distribution: Redhat, Ubuntu
Posts: 516

Rep: Reputation: 139Reputation: 139
Code:
# du -hx /dir/ | sort -h | grep -i '^[0-9]*\.\?[0-9]*G'
gnu grep:
Code:
# du -hx /dir/ | sort -h | grep -Ei '^[0-9]*.?[0-9]*G'
# du -hx /dir/ | sort -h | grep -Ei '^[[:digit:]]*.?[[:digit:]]*G'
perl style:
Code:
# du -hx /dir/ | sort -h | grep -Pi '^\d*.?\d*G'

Last edited by mddnix; 06-20-2013 at 08:34 AM.
 
Old 06-20-2013, 07:56 AM   #3
jitendra.sharma
Member
 
Registered: Mar 2013
Location: ahmedabad
Distribution: CentOS, Ubuntu, Debian
Posts: 92
Blog Entries: 1

Rep: Reputation: Disabled
Why you want use du -hx /dir you can use simple #du -hs /dir command for the size in GB and MB.
 
  


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




All times are GMT -5. The time now is 04:55 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration