Created
December 15, 2016 22:43
-
-
Save daniel-perry/717d069c6c8b04c34f6061382e1e43ca to your computer and use it in GitHub Desktop.
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
#usage: lsprocs [username] | |
lsprocs(){ | |
uid=`id -u` | |
if [ -z ${1+x} ]; | |
then | |
uid=`id -u` | |
else | |
uid=`id -u $1` | |
echo "uid for $1 is $uid" | |
fi | |
for f in `ls -d /proc/+([0-9])`; | |
do | |
uidline=`cat $f/status | grep Uid`; | |
if [[ $uidline == *"$uid"* ]]; | |
then | |
echo "============="; | |
cat $f/status | grep Name; | |
cat $f/status | grep Uid; | |
cat $f/status | grep Pid; | |
echo "cmdline:" | |
cat $f/cmdline; echo ""; | |
fi; | |
done | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment