How do I list all processes owned by my user?

List all process names for my user.

I could do it with

ps aux | grep username

But the output would be like:

maythux  18343  0.0  0.1 1070868 34504 ?       Sl   Jun03   0:07 empathy
maythux  21562  0.0  0.1 703716 32104 ?        Sl   Jun10   0:00 /usr/bin/python /usr/bin/blueman-applet
maythux  21574  0.0  0.0  53532  2408 ?        S    Jun10   0:00 /usr/bin/obex-data-server --no-daemon 
maythux  25197  0.0  1.0 2199840 258576 ?      Sl   May27   0:24 remmina

But I just want the output look like:

empathy
blueman-applet
obex-data-serve
remmina

So what is the easiest way to do that?


You can easily do it with the ps command itself without any other tool:

ps -U user-name -o comm= 

If you want to sort and remove duplicate entries you can do this:

ps -U user-name -o comm= | sort | uniq

Here's a sample of my output:

liferea
mission-control
nacl_helper
nautilus
nm-applet
notify-osd
nxclient.bin
nxnode.bin
obex-data-serve
okular
polkit-gnome-au

For the sake of completion, you can also use pgrep:

pgrep -lU foobar

this will match Real user ID of the user foobar. This will show the output with PIDs.

If you want only the process names, also with removing duplicates:

pgrep -lU foobar | cut -d' ' -f2 | sort -u  ##Using RUID

pgrep -lu foobar | cut -d' ' -f2 | sort -u  ##Using EUID