1

If a directory is a special file in unix with filenames and corresponding inodes, is there any way to print the entire contents of this file?

Austin
  • 231

1 Answers1

0

You can very well do it just by Vim

  • if I do vim <directory what shows up is a list of contents, but there isn't any inodes. Isn't the directory file supposed to show corresponding inodes? – Austin Oct 30 '16 at 05:28
  • 1
    ls -id /path/to/dir – Arjun sharma Oct 30 '16 at 05:31
  • I know I can do that if I'm just trying to determine the inodes, but I'm really trying to gain a better understanding of the filesystem. If I read the entire contents of a directory file, shouldn't part of that be the inodes? – Austin Oct 30 '16 at 05:33
  • actually not getting what output you are looking for – Arjun sharma Oct 30 '16 at 05:41
  • I understand the confusion, I'm not looking for particular data, for any particular purpose. I just read that in Unix, a directory is actually a file which has file names and corresponding inodes inside it. So I wanted to print the entire contents of the directory "file" to see what else it might have inside and what it looks like. – Austin Oct 30 '16 at 05:43
  • 1
    i guess the command you are looking for is stat , looking into it man page you all get load of information , see if it helps you , try various switch mentioned in man pages of stat , else we ll dig further – Arjun sharma Oct 30 '16 at 05:48
  • 1
    @Jake I don't think it's really guaranteed to be a file, you just can think of it as a file with such entries but how exactly it's done one FS level is not defined. Far from an expert on this though, I have no idea how the API for this looks like. – phk Oct 30 '16 at 06:38