Skip to content

Instantly share code, notes, and snippets.

@henri
Last active November 18, 2025 20:48
Show Gist options
  • Select an option

  • Save henri/bf8cbcb1fc08c64742d4ba0b4de75ae5 to your computer and use it in GitHub Desktop.

Select an option

Save henri/bf8cbcb1fc08c64742d4ba0b4de75ae5 to your computer and use it in GitHub Desktop.
open file linux cheat sheet
# show the limits in place on the system
ulimit -a
# system wide ulmits
ulimit -Sn # soft limit
ulimit -Hn # hard limit
# list open files for all processes and sort them by how many files are open
for pid in /proc/[0-9]*; do echo "PID = $(basename $pid) : $(ls $pid/fd 2>/dev/null | wc -l) open files"; done | sort -n -k5,5
# list all open files (provided not to many
lsof | wc -l
# list open files outout blocking - may not provide accurate counts
lsof -b 2>&1 | wc -l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment