Skip to content

Instantly share code, notes, and snippets.

@tuxedocat
Created June 9, 2016 00:20
Show Gist options
  • Save tuxedocat/2b3576a1ba66284dafc07fb00c0e6354 to your computer and use it in GitHub Desktop.
Save tuxedocat/2b3576a1ba66284dafc07fb00c0e6354 to your computer and use it in GitHub Desktop.
Counts num. of inodes in given directory, writes (n_inodes path) as report, and shows total num. of inode usage.
#!/bin/bash
find $1 -xdev -printf '%h\n' |
sort |
uniq -c |
sort -k 1 -n -r |
tee inodeusage |
tr -s " " |
cut -f 2 -d " " |
python -c"import sys; print(sum(map(int, sys.stdin)))"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment