Get file details by inode

前端 未结 3 849
攒了一身酷
攒了一身酷 2021-01-14 01:07

I need in a bash script to get details about a file when I know the inode.The system is Linux.

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-14 01:25

    Something like so:

    find $SEARCHPATH -maxdepth $N -inum $INUM -exec ls -l {} \;
    

    Since the filename links to the inode, ans not vice-versa, you need to do this in a brute force manner. The -maxdepth is to narrow it down if you have some idea of where it should be. You can also ad -xdev if your searching a tree containing multiple filesystems.

提交回复
热议问题