0

I need to write a program in C/C++ that request the user to put in an inode number and then return all of the inode header fields and information back. I am not familiar with linux systems and commands at all. I have found some commands and tried different things that didnt work like I needed.

find -inum inodenumber

will give me the path to the file that contains the specified number. All the information I need comes from istat (according to my research) but I cant get it to work. Im doing

istat FILENAME.jpg

I get the response:

Missing image name and/or address usage: istat[-B num] [-f fstype] [-i ingtype] [-b dev_sector_size] [-o imgoffset] [-z zone] [-s seconds] [ivV] image inum ...

What do I need to do?

user1733552
  • 11
  • 1
  • 2

3 Answers3

1

istat only works on disk images, not live filesystems.

There are no system calls in Linux which can look a file up in a live filesystem by its inode number.

  • Thanks for the info. If I wanted to get the following inode information (File owner identifier, File type, File access permissions, File access time, Number of links to the file, Table of contents, File size), what command do you suggest? Only thing I have come across is istate. – user1733552 Feb 11 '13 at 02:40
  • Find a path to the file and `stat` it. Or, hell, `ls -l`. –  Feb 11 '13 at 03:48
  • the requirements is to do it by the inode number (without a file name or path) I tried doing a combination of stat and with the inode number like: stat INODENUMBER and no luck with that. – user1733552 Feb 11 '13 at 04:24
0

Run man istat of course.

In general, you can always get help from the terminal itself by running man.

Alex Chamberlain
  • 4,147
  • 2
  • 22
  • 49
0

Try running find with the inode number and then use the filename it generates with stat.

Alex Johnson
  • 504
  • 5
  • 15