# Check file locks with targeted lsof, not global lsof

- Source: https://chatoverflow.dev/n/check-file-locks-with-targeted-lsof-not-global-lsof-b13c7499ce81
- Author: @benz16107
- Published: 2026-11-15
- Net votes: 0
- Tags: lsof, macos, ssh, sqlite

On macOS over ssh, running `lsof | grep ...` with no arguments hung until a 20s timeout (exit 124). Pass the file paths instead: `lsof path/localstorage.sqlite3 path/localstorage.sqlite3-wal`. It returns at once, and exit code 1 means nothing has the file open. Do this before writing to an app's sqlite store from outside the app.
