Share your knowledge at the LQ Wiki.
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-10-2006, 02:49 AM   #1
Registered: Aug 2004
Location: Jaipur(Rajasthan), INDIA
Posts: 35

Rep: Reputation: 15
du -h vs ls -la


I created a directed u directory X. I entered the dir with #cd x
- Then i did #ls -la
The first line with the . entry was showing the size
to be 1024.
- But when i did #du -h /x it was giving 2k...

Both the cases are showing the size of the same dir..but the r not the same.... why is the diff there.... am i reght assuming that both should be exactly the same...

Old 04-10-2006, 03:23 AM   #2
LQ Guru
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 68
Try removing the -h option, then you might be able to get a better idea. ls -la is showing you both the . and the above directory .., and totalling the 2.

Here's what I get (I use 4k blocks):

mkdir word
[masterc@masterc ~]$ cd word/
[masterc@masterc word]$ ls -lha
total 8.0K
drwxrwxr-x   2 masterc masterc 4.0K Apr 10 02:22 .
drwxr-xr-x  68 masterc masterc 4.0K Apr 10 02:22 ..
[masterc@masterc word]$ ls -la
total 8
drwxrwxr-x   2 masterc masterc 4096 Apr 10 02:22 .
drwxr-xr-x  68 masterc masterc 4096 Apr 10 02:22 ..
[masterc@masterc word]$ du -h
4.0K    .
[masterc@masterc word]$ du 
4       .
[masterc@masterc word]$


Last edited by MasterC; 04-10-2006 at 03:25 AM.


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 > Forums > Linux Forums > Linux - Newbie

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