To resolve the issue, you can use it ps -aux | grep <prgname>as the root user.
EG: ps -aux | grep firefoxexecuting this command (with root privileges), returns the following result:
sergio 3252 24.1 6.7 1840936 540264 ? Sl 09:48 123:36 /usr/lib/firefox/firefox
root 23059 0.0 0.0 15944 948 pts/7 S+ 18:20 0:00 grep --color=auto firefox
The last line is the command I executed!
ps script, . , , , , Ubuntu 14.
#!/bin/bash
i=0
search="watch"
tmp=`mktemp`
ps -aux | tr -s ' ' | grep "$search" > $tmp
while read fileline
do
user=`echo $fileline | cut -f1 -d\ `
prg=`echo $fileline | cut -f11 -d\ `
prg=`basename $prg`
if [ $prg == $search ]; then
echo "$user - $prg"
i=`expr $i + 1`
fi
done < $tmp
if [ $i == 0 ]; then
echo User not found
fi
rm $tmp