假设我在主目录中
我正在尝试列出所有文件/etc
以显示sh
以inode
数字开头的所有文件
我尝试了以下方法:
sudo find /etc -name 'sh*'
# this works but without the inode
ls - '/etc' -i | grep 'sh*'
# this command gets the inode but includes all files that contain 'sh' not starts with
任何帮助表示赞赏
您可以使用
find /etc -name 'sh*' -printf '%i %f\n'
或者(如果您不需要进入子目录)
stat -c '%i %n' /etc/sh*
甚至
ls -1i /etc/sh*
来自man ls
:
-i, --inode print the index number of each file
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句