ambevar-dotfiles/.scripts/lsofstat

22 lines
275 B
Plaintext
Raw Normal View History

#!/bin/sh
if [ "$1" = "-h" ]; then
cat<<EOF
Usage: ${0##*/}
Print number of open files per process.
EOF
exit
fi
LSOFOUT="$(lsof|awk '{print $1}')"
while IFS= read -r i; do
2016-06-23 23:18:36 +02:00
printf "%s " "$i"
echo "$LSOFOUT" | grep -c "^$i"
done<<EOF
$(echo "$LSOFOUT" | sort -u)
EOF