Last active
August 29, 2015 14:22
-
-
Save pityonline/ca231d0366886b6b8837 to your computer and use it in GitHub Desktop.
find who's current in some path
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rename with specification