Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [pkill]

The tag has no usage guidance.

5
votes
4answers
1k views

How to stop a script within another script

I'm running Ubuntu 16.04, using a terminal emulator. I have two scripts: a.sh and b.sh.  a.sh calls b.sh. a.sh echo "a is running" sleep 5s bash b.sh sleep 5s echo "a is still running" b.sh echo "...
4
votes
1answer
23k views

How to kill all processes owned by `user` on Centos 7? [duplicate]

I read in an online flash card that the command is: pkill -u bob $(pgrep -u bob) However, I think this is wrong. I think it's saying: Kill all the processed owned by bob, and 4572\n4600 Because: ...
1
vote
1answer
267 views

MacOS: su pkill -9 “process_name” = sorry

How to use pkill as su on a Mac? When I run su pkill -9 "RFBEventHelperd" in the terminal I get su: Sorry (but works as sudo). I am looking for a way to kill this process from inside a script that ...
1
vote
1answer
38 views

Process is running [closed]

I have run the following command as root today morning sh /home/suio/LoadSnortSingature.sh > /home/suio/logs.txt 2>&1 after some time the session of the terminal closed and I have relogged in ...
0
votes
1answer
571 views

What is the `-KILL` option in `pkill` command

I have found a way to logout any user by using the command line. By executing the command pkill -KILL -u <username>, I can now log myself out from the session I have entered. My question is ...
0
votes
1answer
25 views

Tagging a process so I can kill it later easily by identifying

I need to tag a generic process (I don't really control the command being run). Could I do something like this: run_special_cmd(){ "$@" -- --very-special-command } run_special_cmd sleep 5000 &...
0
votes
2answers
248 views

pkill -P variable not working when running .sh under cron

I have a very simple .sh script to kill a process. The processes saves its PID to pid2.txt. pkill -e -P $(cat pid2.txt) exit When I run this as sudo ./myscript.sh from the command line it works fine....
0
votes
2answers
187 views

Using `pgrep` to emulate `ps -ef` for use in a `for i in` loop

Ubuntu 16.04 I am used to using this command line to kill any process match said COMMAND for i in $(ps -ef | grep COMMAND | awk '{ print $2 }'); do kill -9 "$i" &>/dev/null;done shellcheck ...
0
votes
1answer
4k views

How to force a PID to terminate? [duplicate]

Yes, I've tried all the basic kill, pkill, etc. methods that come up with a Google search. Sometimes it works, other times it seems something is preventing the process from terminating. There is no ...
0
votes
1answer
430 views

pkill does not work on Ubuntu 16.04

I list all the processes in the system using ps -aux and I found this java process: 10253 2.1 10.1 3259172 398864 pts/0 Tl 06:58 0:09 java -jar /opt/can-peris/core-price-update/menu-core-...