Last active
July 14, 2016 23:04
-
-
Save akpoff/a71855d7246fa0c268e344d9f1dc6558 to your computer and use it in GitHub Desktop.
Count Hard Links in a Directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# count hard links in a directory | |
# blech -- includes current and present dir | |
# ls -laRi | cut -d ' ' -f 1 | egrep '^[0-9]+' | sort | uniq -cd | sort -n | |
# better -A excludes . and .. | |
# ls -lARi | cut -d ' ' -f 1 | egrep '^[0-9]+' | sort | uniq -cd | sort -n | |
# best | |
find "$1" -type f -ls | cut -d ' ' -f 1 | sort | uniq -c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment