LinuxQuestions.org
Help answer threads with 0 replies.
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
 
LinkBack Search this Thread
Old 04-19-2011, 03:23 PM   #1
dmchenry
LQ Newbie
 
Registered: Apr 2007
Posts: 3

Rep: Reputation: 0
Display True file size using ls -l command in CentOS


I am trying to figure out the actual size of files and directories on a CentOS Linux 5 server and when I do a ls -l I see for example at the Directory of /Data 4096 but once in side the directory and I do a ls -l I see larger file sizes. How do I get the actual file size of a Directory to show up?
Thank you,
Darin
 
Old 04-19-2011, 03:30 PM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,566

Rep: Reputation: 510Reputation: 510Reputation: 510Reputation: 510Reputation: 510Reputation: 510
Use "du -sx /Data" .

The 4096 you are seeing is the size necessary to store the meta-data about files (including the file names contained in that directory), not the size of everything in the directory.

http://www.linuxquestions.org/questi...39#post2978839
 
Old 04-19-2011, 03:34 PM   #3
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 2,853

Rep: Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696
You want to know the size of the directory and it's content, so try
Code:
du -h dirname
which will show you the files, the size of the files (in "human" readable form) and the size of the directory.
Code:
du -sh dirname
will show you on the total size of the directory and
Code:
man du
will tell you about the du utility (and suggest See Also.

Hope this helps some.

Last edited by tronayne; 04-19-2011 at 03:36 PM.
 
1 members found this post helpful.
Old 04-20-2011, 07:47 AM   #4
dmchenry
LQ Newbie
 
Registered: Apr 2007
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks

Thanks for the replies. tronayne that was exaclty what I was looking for Thank You
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Display by File Name, File Size, and File Owner using ls akeenabawa Linux - Newbie 9 08-15-2008 02:21 PM
Which command will use to display all .php file have size bigger than 30kb niitpro Linux - Newbie 3 09-09-2007 08:38 AM
Can you write a script to display file name, Inode, and size of any file? JaxsunApex Linux - Newbie 3 01-30-2007 08:39 AM
The command "df -h" no show me the size of partition true! sandrobr Linux - Enterprise 7 01-03-2005 03:31 AM
redhat command to display the size of directory please! sandrinechen Linux - Newbie 4 04-19-2004 03:19 AM


All times are GMT -5. The time now is 05:45 AM.

Main Menu
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