Results 1 to 7 of 7
Hey,
I've been learning Linux, primarily through the book "The Unix Programming Environment". I know that there's a difference between Linux and Unix, but most of the stuff (pipes, grep, ...
- 04-05-2011 #1Just Joined!
- Join Date
- Apr 2011
- Posts
- 3
Directories in Linux
Hey,
I've been learning Linux, primarily through the book "The Unix Programming Environment". I know that there's a difference between Linux and Unix, but most of the stuff (pipes, grep, etc.) seems to translate really well. Anyway, in the book, it says that everything is a file, even directories, and even goes so far as to read the bytes in a directory file using od. But when I tried this with my linux computer, I go the following error: read error: Is a directory
00000000
So, my question is: how are directories handled in Linux? Are they files? Or what?
- 04-05-2011 #2
Hello and Welcome.
They are Directories. Here is an in depth explanation for file system hierarchy.
Filesystem Hierarchy StandardI do not respond to private messages asking for Linux help, Please keep it on the forums only.
All new users please read this.** Forum FAQS. ** Adopt an unanswered post.
- 04-05-2011 #3Just Joined!
- Join Date
- Apr 2011
- Posts
- 3
After a bit more googling, I found this:
tldp.org/LDP/intro-linux/html/sect_03_01.html
which states that "A Linux system, just like UNIX, makes no difference between a file and a directory, since a directory is just a file containing names of other files."
So why can't I od a directory?
- 04-05-2011 #4
Well, I found this explanation.
Senior Advisor - http://www.unix.com
- 04-05-2011 #5Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,970
Basically, Linux does not allow this, normal read operations on directories. Personally, it seems silly to me, as they are, as you surmise, just files, but there it is...
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 04-05-2011 #6Just Joined!
- Join Date
- Apr 2011
- Posts
- 3
Thanks for the explanations!
- 04-08-2011 #7
A crazy thing called Meta-Data.
Any section of your hard drive (storage) that is dedicated to a specific purpose is a file just like old fashioned paper files. It's like segregation for data. A filing system is meant to organize your data. A directory is a file in that it is on your hard drive for a specific purpose and this is to hold information on another file. This is another form of mata data. Mata data is Very important to learn if you want to go past a casual user in computing. So a directory which is a file that holds data about a file in which the latters purpose is only to hold data like a saved letter or so on. In a way a directory or file that you see in nautilus and dolphin are mearly short cuts represented by an icon of information on the data you need like the sample letter. Nautilus and Dolphin do not actually hold the data of the sample letter but the information on how to find it in storage. It's like a virtual file system so the user can naviagate through files themselves. The kernel uses the info in the directories to access the files. Nautilus and Dolphin for example do not store the images for icons in the file that represents them. If you view the files contents there is no jpg extenstion. The images for these icons is actually in another file.
Sorry for being confusing and this is not a current topic of mine but it will help you get a grasp on Meta-Data.


Reply With Quote