Skip to content

Instantly share code, notes, and snippets.

@nlitsme
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nlitsme/8956b34490eee4cc991e to your computer and use it in GitHub Desktop.
Save nlitsme/8956b34490eee4cc991e to your computer and use it in GitHub Desktop.
view recent filesystem activity using lsof
#!/bin/bash
if [[ $(id -u) -ne 0 ]]; then
sudo $0 "$@"
exit $?
fi
diff <(sleep 1 ; lsof -n -P| grep -v "^\(sleep\|lsof\|grep\|diff\|bash\)" ) <(lsof -n -P| grep -v "^\(sleep\|lsof\|grep\|diff\|bash\)" )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment