通过inode获取文件详细信息 [英] Get file details by inode

查看:404
本文介绍了通过inode获取文件详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我知道inode时,我需要在bash脚本中获取有关文件的详细信息.系统是Linux.

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

推荐答案

如果仅处理ext2/3文件系统,则可以使用debugfs进行inode到文件的查找,这可能比查找文件快得多.将find用于包含许多文件的大型文件系统.

If you're dealing exclusively with an ext2/3 filesystem, you can use debugfs to do your inode to file look-up, which can be considerably faster than using find for large filesystems with many files.

debugfs -R "ncheck $inode" /dev/device 2> /dev/null | tail -1 | awk '{print $2}'

尽管查找仍然是最好的选择,但我不知道这与文件系统无关.

Find is still really your best bet though, there is nothing else I know of that is filesystem agnostic.

这篇关于通过inode获取文件详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆