LinuxQuestions.org
Register a domain and help support LQ
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 04-30-2015, 03:46 AM   #1
adel87
Member
 
Registered: Nov 2014
Posts: 37

Rep: Reputation: Disabled
Smile see all size of folder in "/"


Hi
I'm new in linux
I want to see all folder with their sizes in /
Please what is the commande for this.
Thank you
 
Old 04-30-2015, 04:22 AM   #2
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
You can run:

Code:
du -ms /* | sort -nr
 
Old 04-30-2015, 04:24 AM   #3
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,586

Rep: Reputation: 698Reputation: 698Reputation: 698Reputation: 698Reputation: 698Reputation: 698
Quote:
cd /
sudo du -sh * |less
That should do it. du = Disk Usage
 
Old 04-30-2015, 04:28 AM   #4
adel87
Member
 
Registered: Nov 2014
Posts: 37

Original Poster
Rep: Reputation: Disabled
Smile

Hi Thank you
when i tape du -ms /* | sort -nr
I've this message
"t access `/proc/7564/task/7564/fd/4': No such file or directory
du: cannot access `/proc/7564/task/7564/fdinfo/4': No such file or directory
du: cannot access `/proc/7564/fd/4': No such file or directory
du: cannot access `/proc/7564/fdinfo/4': No such file or directory

Thank you
 
Old 04-30-2015, 04:29 AM   #5
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
You have to run this command either as root or the account which have sudo access:

Code:
sudo du -ms /* | sort -nr
 
Old 04-30-2015, 04:32 AM   #6
adel87
Member
 
Registered: Nov 2014
Posts: 37

Original Poster
Rep: Reputation: Disabled
Hi thank you
I'm root user ,I'm using centos 6.
Thank you
 
Old 04-30-2015, 04:40 AM   #7
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
It will show those messages in the beginning don't worry about that let the command complete. I have checked it on my system and it works perfectly fine.
 
Old 04-30-2015, 04:50 AM   #8
adel87
Member
 
Registered: Nov 2014
Posts: 37

Original Poster
Rep: Reputation: Disabled
Hi thank you
Can I remove this messages and please why I have this message?
Also can I have the size in gigabyte? (I use du -hs) but the size in gygabyte ,kilo and mega
so It is not nice when I use the sort
Thank you
 
Old 04-30-2015, 04:55 AM   #9
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
You can redirect the error message. If you are using -h which is for human-readable just don't use sort -nr with it as it will be confusing. You can use the following command:

Code:
du -sh /* 2> /dev/null
 
Old 04-30-2015, 04:58 AM   #10
adel87
Member
 
Registered: Nov 2014
Posts: 37

Original Poster
Rep: Reputation: Disabled
Hi thank you.
Please what is the meaning of 2> and /dev/null
Thank you.
 
Old 04-30-2015, 05:00 AM   #11
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
You're welcome.

2 is exit code. What I am doing here is telling the system if there is anything which has got exit status / code (2) in the output then redirect that to /dev/null

You have different exit codes like:

0 = success
1 = warning
2 = errors

You can redirect both errors and warnings in one go as follows:

Code:
du -sh /* 2>&1 /dev/null
When I will run this command any error / warnings in the output will be redirected to /dev/null
 
Old 04-30-2015, 05:13 AM   #12
adel87
Member
 
Registered: Nov 2014
Posts: 37

Original Poster
Rep: Reputation: Disabled
Hi thank you
Please when you tape 2>&1
What is the meaning of > and &

Thank you.
 
Old 04-30-2015, 05:25 AM   #13
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,133

Rep: Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273Reputation: 2273
see man bash and check the section about redirection.
1 and 2 are file descriptors, > means redirection.
 
Old 04-30-2015, 05:32 AM   #14
adel87
Member
 
Registered: Nov 2014
Posts: 37

Original Poster
Rep: Reputation: Disabled
Hi thank you
Please what is the meaning "&"?

" 2>&1 " it mean redirect errors in &1??
Thank you
 
Old 04-30-2015, 05:41 AM   #15
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
Quote:
2>&1 " it mean redirect errors in &1
That means redirect both errors and warning. I have already given the example:

Code:
du -sh /* 2>&1 /dev/null
If I break this command in sections then:

du -sh /* -- If any errors or warning will be reported by this command then using:

2>&1 -- It will be redirect to:

/dev/null
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
L.O.document font prints the size of Firefox default "noto sans 22" instead of "ns12" 1sweetwater! Linux - Software 1 02-11-2015 08:45 AM
What are the options "Nosuid" "mode" "size" in /etc/fstab? tuxfiles.org does not help pstein Linux - Newbie 1 11-16-2012 01:58 AM
How do I increase the size of my "Home " folder. Colin M Linux - Newbie 11 02-15-2010 06:42 PM
How to create a "fixed-space"-a folder that is EXT2 inside and whatever size-50MB? linus72 Linux - Newbie 3 04-08-2009 09:47 AM
How to issue "ls" command start with the largest file size in a folder? fjkum Linux - Newbie 5 07-27-2006 04:28 AM


All times are GMT -5. The time now is 04:47 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration