Skip to content

Instantly share code, notes, and snippets.

@MadhavJivrajani
Last active December 12, 2020 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MadhavJivrajani/e632b28a580304c4c0dbc1f88234261b to your computer and use it in GitHub Desktop.
Save MadhavJivrajani/e632b28a580304c4c0dbc1f88234261b to your computer and use it in GitHub Desktop.
Scripts to get inode numbers of each file in a directory
#!/bin/sh
# gets inode numbers of all files in a directory (recursive)
find . -type f | awk '{print $NF | "xargs stat" }' | awk '/File/{file=$2} /Inode/ {print file, "Inode: " $4}'
#!/bin/sh
# gets inode numbers of files only in the current level, non-recursive
find . -maxdepth 1 -type f | awk '{print $NF | "xargs stat" }' | awk '/File/{file=$2} /Inode/ {print file, "Inode: " $4}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment