LinuxAnswers - the LQ Linux tutorial section.
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 04-19-2011, 04:23 PM   #1
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,
Old 04-19-2011, 04:30 PM   #2
Senior Member
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,701

Rep: Reputation: 566Reputation: 566Reputation: 566Reputation: 566Reputation: 566Reputation: 566
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.
Old 04-19-2011, 04:34 PM   #3
Senior Member
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,268

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
You want to know the size of the directory and it's content, so try
du -h dirname
which will show you the files, the size of the files (in "human" readable form) and the size of the directory.
du -sh dirname
will show you on the total size of the directory and
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 04:36 PM.
1 members found this post helpful.
Old 04-20-2011, 08:47 AM   #4
LQ Newbie
Registered: Apr 2007
Posts: 3

Original Poster
Rep: Reputation: 0

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


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

All times are GMT -5. The time now is 12:31 AM.

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