# Miscellaneous Linux tricks ## Find unlinked but open files When Du can't find it, but Df says it's there, I reach for this: ```sh sudo lsof -l +L1 | { sed -u 1q; sort -rn -k7; } | awk 'NR == 1 || $7 > 1024 ** 2' | numfmt --header --field=7 --to=iec --suffix=B ``` Explanation: The `lsof` invocation lists open files which have fewer than one link (`+L1`), showing numeric UIDs (`-l`) (my unlinked files are often from Docker containers, so the host's `passwd` database makes no sense). The rest of the pipeline sorts the output by size descending (first printing the header line), excludes files one megabyte or less in size, and renders the size in human-readable form. ## Navigation => index.gmi Site index => gemini://sdf.org/nepeta/linux-misc.gmi Gemini permalink for this page => http://nepeta.chaosnet.org/linux-misc.html HTTP permalink for this page