Search code examples
bashconky

get pid of specific application instance


Lets say I want to kill just the conky instance with the configuration file conkyrc_update and not the other one workload. Is there a way to get the pid of a specific application instance?

[sebastian@archlinux-work ~]$ ps aux | grep conky
sebasti+  4277  1.0  0.1 102724 11408 ?        S    15:02   0:02 conky -c /home/sebastian/scripts/conky_sysmon/conkyrc_update
sebasti+  4278  0.0  0.1 250136  9720 ?        Sl   15:02   0:00 conky -c /home/sebastian/scripts/conky_sysmon/conkyrc_workload

Solution

  • You can use pgrep with --full parameter (to match against the arguments too, and not only the process name):

    pgrep --full conkyrc_update
    

    and if you want to simply kill it, you can just:

    pkill --full conkyrc_update