I need to write a one line command to find the PID by process name and kill it.
Here is how I would MANUALLY do it:
Code:
MSNTV2:~# ps aux | grep /usr/bin/X11/X
root 4148 0.4 14.2 19600 17876 ? S< 20:17 0:02 /usr/bin/X11/X -dpi 100 -nolisten tcp
root 4274 0.0 0.4 1916 588 pts/2 R+ 20:27 0:00 grep /usr/bin/X11/X
MSNTV2:~# kill 4148
Note that it returns 2 PIDs, one of which is false.
Doing this:
Code:
MSNTV2:~# killall X
X: no process killed
MSNTV2:~# killall /usr/bin/X11/X
/usr/bin/X11/X: no process killed
MSNTV2:~#
...will not work.
I need a one line command that would get that done, and I could put it into a shell script.
Thanks in advance.