15
for this purpose I will enter
sudo gvim &
ps aux | grep gvim
supplies me with the following output
root 11803 0.0 0.0 12064 2776 pts/3 T 12:17 0:00 sudo gvim
to grab only the pID i prefer to use awk
ps aux | awk '/gvim/ {print $2}'
which would return simply
11803
I could kill the program from awk as well by piping a kill command to bash
ps aux | awk '/gvim/ {print "sudo kill -9 "$2}' | bash