Skip to main content
added 107 characters in body
Source Link
Hauke Laging
  • 94.5k
  • 21
  • 132
  • 185
for dir in /proc/[1-9]*/fd; do
    echo "$dir"
    cd "$dir" &>/dev/null || continue
    set -- *
    echo $#
    echo
done

This is the output of lsof. I do not know why it differs.

lsof -F p | sort | uniq -c | sort -n
for dir in /proc/[1-9]*/fd; do
    echo "$dir"
    cd "$dir" &>/dev/null || continue
    set -- *
    echo $#
    echo
done
for dir in /proc/[1-9]*/fd; do
    echo "$dir"
    cd "$dir" &>/dev/null || continue
    set -- *
    echo $#
    echo
done

This is the output of lsof. I do not know why it differs.

lsof -F p | sort | uniq -c | sort -n
Source Link
Hauke Laging
  • 94.5k
  • 21
  • 132
  • 185

for dir in /proc/[1-9]*/fd; do
    echo "$dir"
    cd "$dir" &>/dev/null || continue
    set -- *
    echo $#
    echo
done