Skip to content

Instantly share code, notes, and snippets.

@pityonline
Last active August 29, 2015 14:22
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 pityonline/ca231d0366886b6b8837 to your computer and use it in GitHub Desktop.
Save pityonline/ca231d0366886b6b8837 to your computer and use it in GitHub Desktop.
find who's current in some path
#!/bin/bash
if [ $# -ne 1 ]
then
echo "Usage: sudo whoisat /path"
else
path=$1
for proc in $(ps aux | awk '/pts/ {print $2}')
do
ls -l --time-style=+'%F %T' /proc/$proc/cwd 2>/dev/null
done | grep $path | awk '{print $3, $4, $6, $7, $8, $NF}' | column -t
fi
@pityonline
Copy link
Author

Rename with specification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment