LinuxQuestions.org
Visit Jeremy's Blog.
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-24-2008, 08:19 AM   #1
laucian
Member
 
Registered: Oct 2005
Distribution: Ubuntu 9.04
Posts: 124
Blog Entries: 2

Rep: Reputation: 15
help with ls -lh -lhd


hi everyone..i have this terminal window

Code:
cumhur@pvs-a:~$ cd testarchiv/
cumhur@pvs-a:~/testarchiv$ ls -lh
total 260K
-rw-r--r-- 1 cumhur cc08 256K 2008-04-24 13:22 zufallsdatei
cumhur@pvs-a:~/testarchiv$ cd ..
cumhur@pvs-a:~$ ls -lhd testarchiv/
drwxr-xr-x 2 cumhur cc08 4,0K 2008-04-24 13:22 testarchiv/
the directory has only a file which is 256K..why does it appear like 4.0K after ls -ldh ?
 
Old 04-24-2008, 08:43 AM   #2
duryodhan
Senior Member
 
Registered: Oct 2006
Distribution: Slackware 12 Kernel 2.6.24 - probably upgraded by now
Posts: 1,054

Rep: Reputation: 46
ls -d shows only directory entries which are always just 4K
 
Old 04-24-2008, 08:47 AM   #3
laucian
Member
 
Registered: Oct 2005
Distribution: Ubuntu 9.04
Posts: 124
Blog Entries: 2

Original Poster
Rep: Reputation: 15
thanks a lot..
 
Old 04-24-2008, 08:51 AM   #4
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
My explanation may not be 100% on track with my thinking, so somebody please correct me if need be, but here goes:

The -d option for ls only lists the "directory entries instead of the contents"; which makes me think that it will only list the directories within the current working directory and not the files within. (I don't have access to a Linux box right now, so I can't test this theory out.)

The reason the size of the directory is only 4.0K is a nice reminder that you're using a UNIX-oriented system: everything is a file. Directories are just pointers to table entries, and what you're getting is the size of the file that is required to direct the computer to the appropriate "inode" table. Once formatted, a hard drive is nothing more than a giant inode table which says, "This file exists here, this directory refers to the container for these files...", etc.
 
  


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
What happened to lhd.zdnet.com? SparceMatrix Linux - Hardware 0 02-01-2003 04:55 PM

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

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