
말 그대로 이 질문에 답하는 데 도움이 될 만한 내용이 Google에 없습니다. 다른 매개변수를 ls -i
?
답변1
예, -i 인수는 ls 명령이 나열하는 각 파일 또는 디렉토리의 inode 번호를 인쇄합니다. 디렉토리의 inode 번호를 인쇄하려면 -d 인수를 사용하여 디렉토리만 나열하는 것이 좋습니다. /path/to/dir 디렉토리의 inode 번호를 인쇄하려면 다음 명령줄을 사용하십시오.
ls -id /path/to/dir
에서 man ls
:
-d, --directory
list directory entries instead of contents, and do not derefer‐
ence symbolic links
-i, --inode
print the index number of each file
답변2
이는 stat에서도 작동합니다.
DIR=/
stat -c '%i' $DIR
에서man stat
:
-c --format=FORMAT
use the specified FORMAT instead of the default; output a new‐
line after each use of FORMAT
[...]
The valid format sequences for files:
%i inode number
답변3
-i
옵션을 사용하여 파일 및 디렉터리의 inode를 찾을 수 있습니다.
ls -id /home/user/dir
시스템에서 소비된 inode 정보를 얻을 수 있습니다.
df -hi
답변4
C++에서:
#include <sys/stat.h>
ulong getInode( const QString &path )
{
struct stat st;
stat( path.toUtf8(), &st );
return st.st_ino;
}
이는 파일과 폴더에 적용됩니다.