22 lines
275 B
Bash
Executable File
22 lines
275 B
Bash
Executable File
#!/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
|
|
printf "%s " "$i"
|
|
echo "$LSOFOUT" | grep -c "^$i"
|
|
done<<EOF
|
|
$(echo "$LSOFOUT" | sort -u)
|
|
EOF
|