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 04-10-2006, 02:49 AM   #1
p_test
Member
 
Registered: Aug 2004
Location: Jaipur(Rajasthan), INDIA
Posts: 35

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


Hi

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...

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

Rep: Reputation: 69
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):

Code:
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]$
HTH

Cool

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


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



LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:44 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
Open Source Consulting | Domain Registration